Created
November 5, 2010 15:56
-
-
Save tobiashm/664347 to your computer and use it in GitHub Desktop.
FunctionDeclarations vs FunctionExpression
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
try { | |
print(fn1); | |
print(fn2); | |
function fn1 () {} // FunctionDeclarations | |
(function fn2 () {}) // FunctionExpression | |
} catch (e) { | |
print(e); // => ReferenceError: Can't find variable: fn2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment