Faster async functions and promises

 

https://v8.dev/blog/fast-async

 

async function computeAnswer() {
return 42;
}
undefined
const p = computeAnswer();

undefined
p.then(console.log);

42
Promise {<resolved>: undefined}

 

async function foo() {
const v = await 42;
return v;
}
undefined
const p = foo();

undefined
p.then(console.log);

42
Promise {<resolved>: undefined}

 

 

posted @ 2019-09-27 20:11  papering  阅读(192)  评论(0编辑  收藏  举报