Skip to content

Instantly share code, notes, and snippets.

@IQAndreas
Last active August 29, 2015 14:20
Show Gist options
  • Save IQAndreas/b1a213d1e0b5e3828cc4 to your computer and use it in GitHub Desktop.
Save IQAndreas/b1a213d1e0b5e3828cc4 to your computer and use it in GitHub Desktop.
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