3 ms·
There's a tiny benefit of the doubt to be given here that while async/await is several years old, support for "top-level await" was only more recently standardi
by WorldMaker 3y ago
There's a tiny benefit of the doubt to be given here that while async/await is several years old, support for "top-level await" was only more recently standardized and took too long for common LTS versions of Node to also support it.
All of these examples appear to be top-level and perhaps they didn't want to write them as async functions or IIFEs, especially for error-handling code.
- hot_gril 3y agoThat makes sense, someone copy-pasting async code into a JS console would get errors not too long ago. There's nobody to blame for this but myself, just wish I discovered earlier on how async/await works, along with other modern JS stuff that you won't see everywhere because it's new.