In this article https://riptutorial.com/javascript/example/7746/looping-with-async-await I read that we wait on every iteration of "for of" loop, but after I checked it in codesandox I realized that all the promises start being executed simultaniously, so the loop doesnt stop on every iteration, but the code inside every iteration stops. Does this article have incorrect info?
My code
const promises = [];
for (let i = 1; i < 4; i++) {
promises.push(
new Promise((res, _) => {
setTimeout(async () => {
res(i);
}, 2000);
})
);
}
(async () => {
for (let promise of promises) {
const r = await promise;
console.log(r);
}
})();
