0

Why this

for(x = 0; x < 10; x++){
  
  var delay = x;
  
  setTimeout(
    function(){
     $('body').append(delay);
    }, delay)
  
}

Returns this: 9 9 9 9 9 9 9 9 9 9

instead of this : 0 1 2 3 4 5 6 7 8 9

http://jsfiddle.net/c1hotu9a/

nais
  • 105
  • 1
  • 6

0 Answers0