arguments.callee替代

时间:2012-11-24 14:45:10

标签: javascript

由于arguments.callee将被弃用,我将在下面的表达式中使用而不是arguments.callee`:

var self = this;

this.async(function(){
  if(test()){
    then();
  }else{
    self.async(arguments.callee);
  }
});

1 个答案:

答案 0 :(得分:5)

这应该有效。但我不确定它是否适用于所有浏览器。

var self = this;

this.async(function someMethod(){
  if(test()){
    then();
  }else{
    self.async(someMethod);
  }
});