what is the arguments variable an instance of?

后端 未结 2 1884
死守一世寂寞
死守一世寂寞 2021-01-21 18:57

MDN says it is \"an Array like object\" but does not say what it is an instance of.

It is not an HTMLCollection or NodeList.

If I call

2条回答
  •  太阳男子
    2021-01-21 19:14

    You can retrieve the name of the function where arguments returned from using callee.name

    function test() {
      this.args = arguments;
    }
    
    var obj = new test();
    
    console.log(obj.args.callee.name);
    

    function test() {
      return arguments
    }
    
    console.log(test().callee.name);
    

    See also Why was the arguments.callee.caller property deprecated in JavaScript? , Arguments object

提交回复
热议问题