JSFiddle - React, Tailwind, and code Playground
JavaScript
for(var i = 0; i < 10; i++) {
(function(i){ // i will now become available for the someMethod to call
setTimeout(function() {
someMethod(i);
}, i *1000);
})(i); // Pass in i here
}
function someMethod(i) {
console.log('Executed : ', i);
}