Open
Description
Great content. While following along with the lecture locally I noticed.
The later sample code in the exercises (code.js) that have async content may throw the following error:
SyntaxError: await is only valid in async functions and the top level bodies of modules
This might befuddle beginners to JavaScript who are not familiar with promises. I've been modifying code.js to using an IIFE like so and running code.js on the terminal with node.
( async () => {
[ original content of code.js here]
})();
node code.js
Alternatively a function
const main = async () => {
[ original content of code.js here ]
}
main();
node code .js
Metadata
Metadata
Assignees
Labels
No labels