I know there are plenty of resources explaining for await...of
, but I don’t think I’ll ever fully grasp the concept until I see an example that works the exact same way but with more basic syntax.
Thing is, if my understanding is correct, these 2 for
loops should behave the exact same way:
for(const p of iterableWithPromises) {
const q = await p;
// ...
}
for await (const q of iterableWithPromises) {
// ...
}
Is that it? Is this syntax only saving us from creating a new variable inside the loop to store the promise’s result?