Skip to content

Instantly share code, notes, and snippets.

@tobiashm
Created November 5, 2010 15:56
Show Gist options
  • Save tobiashm/664347 to your computer and use it in GitHub Desktop.
Save tobiashm/664347 to your computer and use it in GitHub Desktop.
FunctionDeclarations vs FunctionExpression
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