JavaScript async ์ await
async.awaitโโ
async
// async & await
// clear style of using promise :)
// promise๋ฅผ ์ข ๋ ๊น๋ํ๊ฒ ์ฌ์ฉํ๊ฒ ๋ง๋ค์ด์ค
// 1.async
async function fetchUser() {
//do network reqeust in 10 secs....
return 'ellie';
}
// async ๋ผ๋ ํค์๋๋ฅผ ์ฌ์ฉํ๋ฉด promise๋ ๋๊ฐ์ ๊ธฐ๋ฅ์ ์ํํจ
const user = fetchUser();
user.then(console.log);
console.log(user);await
useful promise APIs
Last updated