for (const item of array) {
await processImage(image, name)
}
Внутри цикла не работает setTimeout
(async () => {
for (const n of [ 1, 2, 3, 4, 5 ]) {
console.log(n);
await new Promise(r => setTimeout(r, 1000));
}
})();
[ 1, 2, 3, 4, 5 ].reduce((promise, n) => promise
.then(() => console.log(n))
.then(() => new Promise(r => setTimeout(r, 1000)))
, Promise.resolve());