"arguments"变量来自"this.callParent(arguments)"在哪里?

She*_*har 3 javascript extjs4

在学习ExtJS 4时,我发现在定义新类时,在initComponent方法中可以使用调用父类的构造函数this.callParent(arguments).

我想知道这个arguments变量(我知道这可能是argsaarg太)的定义,并在其值分配.

例如,如果我按如下方式定义我的类:

Ext.define('shekhar.MyWindow', {

  extend : 'Ext.Window',
  title : 'This is title',

  initComponent : function() {
    this.items = [
      // whatever controls to be displayed in window
    ];

    // I have not defined argument variable anywhere
    // but still ExtJS will render this window properly without any error
    this.callParent(arguments);
  }

});
Run Code Online (Sandbox Code Playgroud)

有谁知道这个arguments变量的定义在哪里,以及如何赋值给它?

hop*_*per 7

arguments变量是Javascript中的一个特殊变量,可在任何函数中使用.它不是一个真正的数组,但它包含传递给函数的参数值,可以像数组元素一样访问它(因此,arguments[0]第一个参数arguments[1]是第二个,依此类推).

有关更多信息和示例,请查看Mozilla开发人员网络上的此页面.