for (var i in [1, 3, 4, 5, 6]) { setTimeout(() => { console.log(i) }, 100); } code example
Example: for (var i = 0; i < 10; i++) { setTimeout(function () { console.log(i) }, 10) } What
for (var i = 0; i < 10; i++) {
setTimeout(
(function (i) {
console.log(i)
})(i),
10
)
}