const a = async ()=>{
const b = new Promise((res, rej)=>{
setTimeout(()=>{
res(10);
}, 2000)
})
try {
console.log('start!!!');
const c = await b; // b함수가 실행될 때까지 기다림. 즉, 동기적으로 변함
console.log(c);
console.log('end!!')
} catch (error) {
console.log(error);
}
}
a();
// start!!!
// (2초 후)
// 10
// end!!