=> promise를 리턴
=> promise를 리턴
=> pending/ fulfilled/ rejected
=> promise
const resolveAfterRandomSeconds = async (message) => {
return new Promise((resolve,reject) => {
setTimeout(() => {
resolve(message);
}, 5000)
})
}
let resut = await resolveAfterRandomSeconds('codestates');
console.log(result) // 'codestates'
문자열을 객체로 바꿔줌
특정 URL로부터 정보를 받아오는 역할
계속 업데이트가 되어야하는 부분(ex. 포털 메인사이트 내 최신뉴스, 미세먼지/날씨 정보 등)
.then(response => response.json())
JSON.parse()
랑 비슷한 기능 함