美文网首页
arguments.callee用法  

arguments.callee用法  

作者: 65_刘璐 | 来源:发表于2016-08-05 15:25 被阅读122次

arguments.callee用法

arguments.callee 在哪一个函数中运行,它就代表哪个函数。 一般用在匿名函数中。

在匿名函数中有时会需要自己调用自己,但是由于是匿名函数,没有名子,无名可调。

这时就可以用arguments.callee来代替匿名的函数。

show me the code:

(function(n){

if(n > 1)
  return n* arguments.calle(n-1);

  return n;

})(10);

上述代码就是用匿名函数实现的计算10的阶乘。用arguments.calle代替匿名函数。

相关文章

  • arguments.callee用法  

    arguments.callee用法 arguments.callee 在哪一个函数中运行,它就代表哪个函数。 一...

  • arguments.callee用法

    arguments.callee 在哪一个函数中运行,它就代表哪一个函数。 一般用在匿名函数中。 在匿名函数中有时...

  • arguments.callee用法

    argument.callee 在那个函数中运行,他就代表哪一个函数。一般用在匿名函数中。在匿名函数中有时候需要自...

  • arguments.callee的用法

    argument为函数内部对象,包含传入函数的所有参数,arguments.callee代表函数名,多用于递归调用...

  • 常用但易忘的一些知识点

    递归调用arguments.callee(); caller和callee:arguments.callee返回当...

  • arguments.callee

    arguments.callee 属性包含当前正在执行的函数。 arguments.callee 从ES5严格模式...

  • arguments.callee 的使用

    先阅读以下递归代码 通过arguments.callee代替函数名 来看看打印出arguments.callee是...

  • JS自身函数调用

    使用arguments.callee 不使用arguments.callee的情况下 给函数添加个名字,并进行调用

  • 14.arguments的callee问题和caller

    function test(){ console.log(arguments.callee == test) ...

  • JS 日常一些记录

    - arguments.callee 从ES5严格模式中删除

网友评论

      本文标题:arguments.callee用法  

      本文链接:https://www.haomeiwen.com/subject/fxghsttx.html