Skip to content

Instantly share code, notes, and snippets.

@karenpeng
Created May 24, 2015 16:09
Show Gist options
  • Save karenpeng/0643c6c697b3ff5fabd4 to your computer and use it in GitHub Desktop.
Save karenpeng/0643c6c697b3ff5fabd4 to your computer and use it in GitHub Desktop.
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