4 ms·
This is a very old text, and I believe he is not referring to function closures (as I assume that you assume) but crazy shit like the long-since-deprecated-but-
by esrauch 14y ago
This is a very old text, and I believe he is not referring to function closures (as I assume that you assume) but crazy shit like the long-since-deprecated-but-still-works arguments.callee.caller.arguments
For example:
function test() { console.log(arguments.callee.caller.arguments); }
function test2(a, b) { test(); }
test2('x', 2);
Will print ['x', 2]. That is horrid; it makes it so you need to know the calling context to determine the behavior (and it could be globally anywhere; in a completely different .js file or even dynamically generated). With a closure the context of a function can generally be determined by simple static code inspection.
- matthewowen 14y agoIt's also deprecated in ECMAScript 5 strict mode.