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
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