Saw this in here JavaScript : For loop with timeout. Can someone explain to me what is the (i)
? I dont see syntactic pattern such as this very often.
for (var i=0;i<=10;i++) {
(function(ind) {
setTimeout(function(){console.log(ind);}, 3000);
})(i);
}
If someone can also share the documentation with great details explaining (i)
, that would be great! Thank you