According to MDN Web Docs:
There are currently no built-in JavaScript objects that have the [Symbol.asyncIterator] key set by default.
My question is how come this is working:
function promises() {
return [
new Promise(x => setTimeout(() => x(1), 1000)),
new Promise(x => setTimeout(() => x(2), 2000)),
new Promise(x => setTimeout(() => x(3), 3000)),
]
}
for await (x of promises()) console.log(x)
for awaitfalls back to a synchronous iterator