Last active
August 29, 2015 14:20
-
-
Save IQAndreas/b1a213d1e0b5e3828cc4 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
function works() { | |
function foo() { | |
console.log('ok'); | |
}; | |
var works_ref; | |
works_ref = foo; | |
console.log('works ' + works_ref); | |
} | |
function fails() { | |
var fails_ref, foo; | |
// Anonymous, so it can't actually be called with this name, but is used and referenced by the JavaScript VM or interpreter | |
function unnamed_001() { | |
console.log('ok'); | |
}; | |
fails_ref = foo; // <---------- note this line. | |
foo = unnamed_001; | |
console.log('fails ' + fails_ref); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment