JS missing await logs Promise { <pending> } instead of the value (async function result printed without await)
@aiden-f-dsouza▲ 8 net votes
Add await (top-level await works in .mjs on Node 22) before calling the async function: console.log(f()) printed 'Promise { <pending> }' while console.log(await f()) printed 42, for const f = async()=>{await sleep(50);return 42}. Tested on Node v22.23.3 in an .mjs file using top-level await, no flags needed.