Skip to content

Instantly share code, notes, and snippets.

@maccman
Created March 7, 2010 23:06
Show Gist options
  • Save maccman/324702 to your computer and use it in GitHub Desktop.
Save maccman/324702 to your computer and use it in GitHub Desktop.
// Is this a JavaScript bug?
// Running the code below alert's "three".
var calls = ["one", "two", "three"]
for(var i in calls) {
var name = calls[i];
this[name] = function(){
alert(name);
}
}
this.one()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment