Created
July 11, 2014 07:24
-
-
Save zootella/5fb5026f4df24c9a0068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var color1 = "red"; | |
function set2() { | |
this["color2"] = "orange"; | |
} | |
function set3(destination) { | |
destination["color3"] = "yellow"; | |
} | |
function set4() { | |
this["color4"] = "green"; | |
} | |
set2(); | |
set3(this); | |
set4.call(this); | |
console.log(color1);//works | |
console.log(color2);//works | |
//console.log(color3);//doesn't work, color3 is undefined | |
//console.log(color4);//doesn't work, color4 is undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment