【javascript】arguments.callee、func.caller

1、arguments.callee

   function test () {console.log (arguments.callee );}  print their function

   Use: perform a recursive function in use immediately

           was num = (function () {

                  if(n == 1) {

                        return 1;

                  }

        return n * arguments.callee(n - 1);

     }())

 

2, func.caller   ( that environment func is called, ES5 strict mode of error)

  function test() { demo(); }

  Demo function () {the console.log (demo.caller);}       // test print function

  demo();

Guess you like

Origin www.cnblogs.com/hjysunshine/p/12284996.html