5 ms·
Not a no-op, it wraps the awaited value in `Promise.resolve()`: async function foo() { const a = await {then(resolve) { resolve(123); }}; consol
by phpnode 9y ago
Not a no-op, it wraps the awaited value in `Promise.resolve()`:
async function foo() {
const a = await {then(resolve) { resolve(123); }};
console.log(a);
}
foo();
- pitaj 9y agoIndeed, you don't use `await` on functions either, it's used on promises. In fact, when used on a non-promise, it still waits an extra loop cycle before resolving and continuing the async function.