Last active
December 11, 2015 01:28
-
-
Save knd/4523269 to your computer and use it in GitHub Desktop.
function invocation
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
function cook() { | |
console.log(this); // 'this' is 'Window' | |
// the default global object of Chrome | |
function prepare() { | |
console.log(this); // 'this' is also 'Window' | |
} | |
prepare(); | |
} | |
var cook101 = function() { | |
console.log(this); // 'this' is 'Window' | |
var prepare101 = function() { | |
console.log(this); // 'this' is 'Window' | |
} | |
prepare101(); | |
} | |
cook(); // direct invocation | |
prepare101(); // direct invocation | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment