728x90 TRY1 5주차 스터디 자바스크립트 웹 개발 기본기 (4) async/await을 활용한 세련된 비동기 코드 [코드잇 부스트 백엔드 스터디 ] 4. async/await을 활용한 세련된 비동기 코드 async/await이란? promise 객체가 등장함으로써 콜백 헬을 해결할 수 있게됨→ 이후에도 발전되어 async/await을 사용하게 됨 async funtion fetchAndPrint(){ const response = await fetch('https://jsonplaceholder.typicode.com/users'); const result = await response.text(); console.log(result);} fetchAndPrint(); asynchronous 의 줄임말을 사용 (비동기를 의미한다)await : 뒤에 코드를 실행하고 코드가 리턴하는 promise 객체를 기다린다fulfilled 상태가 되면.. 2024. 6. 4. 이전 1 다음 728x90