I'm working on porting some old code to 'strict mode', what are the alternatives to the argument.callee and similar argument.caller etc in the ECMA5 standard?
ADDED INFO: I did not specify why I need the argument.caller/callee.
The code I'm porting is using
assert.ok(elemNode, arguments.callee.name + ": Entity - " + entityId + " has been found");
If it were simple recursion I could use function name(){ ... function() ... }, but I can't seem to find what to do with the above code.
Starting with ECMAScript 3, you can have named function expressions. Prior to that function expressions were anonymous, which made arguments.callee
necessary. Named function expressions made it unnecessary. So that's the recommended alternative.
See the MDN docs for callee
[1,2,3,4,5].map(function factorial (n) {
return !(n > 1) ? 1 : factorial(n-1)*n;
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With