[Edit]
+
0
-
0
js for loop with setTimeout() example
1 2 3 4 5 6 7 8// print values from 0 to 9 in the console every second: for (let i = 0; i < 10; i++) { ((index) => setTimeout(() => console.log(index), i * 1000))(i); } // Warning: this solution schedules at once all iterations (it may be not effective for the big amount of the iterations).