Argument.callee.name argument in new Javascript ECMA5 standard

I am working on moving the old code to "strict mode", what are the alternatives to the .callee argument and the similar .caller argument, etc. in the ECMA5 standard?


ADDED INFORMATION: I did not indicate why I need the .caller / callee argument.

The code I'm porting uses

assert.ok(elemNode, arguments.callee.name + ": Entity - " + entityId + " has been found");

If it were a simple recursion, I could use the name () {... function () ...} function, but I cannot find what to do with the above code.

+5
source share
4 answers

ECMAScript 3, . , arguments.callee . . .

MDN

:

[1,2,3,4,5].map(function factorial (n) {
    return !(n > 1) ? 1 : factorial(n-1)*n;
});

( MDN):

  • .
  • ( )
+6

.

"polyfill" arguments.caller, , .

arguments.callee ,

setTimeout(function loop() {
    if( /* condition */ ) {
        loop();  // instead of arguments.callee();
    }
}, 1000);

( arguments )

+3

, .

+1

, . "" ECMAScript 5, . :

setTimeout(function later(){
  // do stuff...
  setTimeout( later, 1000 );
}, 1000 );
0

All Articles