Skip to content

Instantly share code, notes, and snippets.

@karenpeng
Created May 24, 2015 16:09
function bumang(i){
return function(){
console.log(i)
}
}
for(var i = 0; i< 10; i++){
setTimeout(
bumang(i)
, i * 1000);
}
for(var i = 0; i< 10; i++){
setTimeout(
(function(i){
console.log(i)
})(i)
, i * 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment