-
-
Save mrgenixus/9745450 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 (n) { // function has no name, is therefore "anonymous" | |
var i=n*2; | |
if (i > 4) { | |
return undefinedFunc(); // causes a "ReferenceError: undefinedFunc is not defined at Object.<anonymous>" | |
} else { | |
arguments.callee(i); // recurses, adding the anonymous function to the call stack | |
} | |
})(1); | |
(function factor (n) { // function has a name, is not "anonymous" | |
var i=n*2; | |
if (i > 4) { | |
return undefinedFunc(); // causes a "ReferenceError: undefinedFunc is not defined at factor" | |
} else { | |
factor(i); // recurses, adding named function to the call stack | |
} | |
})(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment