You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
f0dder1024
changed the title
Instruction needed to address async issue running code on local computer
Instruction perhaps needed to address async issue running exercise code on local computer
Jul 22, 2023
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]
})();
Alternatively a function
const main = async () => {
[ original content of code.js here ]
}
main();
The text was updated successfully, but these errors were encountered: