JSFiddle - React, Tailwind, and code Playground
by ConnorM
JavaScript
for ( var i=0 ; i<10 ; i++ ) {
(function(box){
setTimeout(function(){
console.log(box)
}, 2000) // This captures the value of i and saves it as box
})(i);
}