Basically, i have a loop where if a certain condition is met, it fires a setTimeout. But the timeout function requires the value of the loop ( i.e 'i'), as example below. How do i do that?
for( var i = 0; i <= 10; i++) {
if(something){
setTimeout(function(){
console.log(i);
}, 1000);
}
}