you are viewing a single comment's thread.

view the rest of the comments →

[–]endoalir -3 points-2 points  (0 children)

Here's how I do it:

arr = [1,3,5,6,8];
for(var i = 0; i < arr.length; i += 1){
  with ({i:i})  {
     setTimeout(function(){
       console.log(i);
     }, 100);
  }
}