I copied and pasted a for-await-of example from MDN and still get an error telling me await is a reserved word. Is this maybe a problem with my Javascript version?
I've tried several different methods, including IIFE's, mostly copying other people's verified code, and I get an error.
var asyncIterable = {
[Symbol.asyncIterator]() {
return {
i: 0,
next() {
if (this.i < 3) {
return Promise.resolve({ value: this.i++, done: false });
}
return Promise.resolve({ done: true });
}
};
}
};
(async function() {
for await (let num of asyncIterable) {
console.log(num);
}
})();
Expect it to run at the very least.
Throws error:
"\index.js:32
for await (let num of asyncIterable) {"
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)