Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
Are you sure about that? I know that you can't use await without async but if I remember correctly I've used async function in top-level scope a few times 🤔
Anyway, I was thinking about that semicolon at the beginning which purpose is to guard against AST, confusing and ugly syntax IMO.
Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
What is this abomination:
😱
You cannot use
async/await
in the global scope. By wrapping your code in anasync
function, this trick will let you useawait
.Are you sure about that? I know that you can't use
await
withoutasync
but if I remember correctly I've usedasync
function in top-level scope a few times 🤔Anyway, I was thinking about that semicolon at the beginning which purpose is to guard against AST, confusing and ugly syntax IMO.
You can test by pasting an
await
command into the browser console.Ahh ya. It's just a guard.