在学习ExtJS 4时,我发现在定义一个新类时,在initComponent方法中可以使用this.callParent(arguments)调用父类的构造函数。
我想知道这个arguments变量(我知道它可以是args、a或arg )是在哪里定义的,以及它的值是在哪里赋值的。
例如,如果我按如下方式定义类:
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);
}
});有人知道这个arguments变量是在哪里定义的,以及如何为它赋值吗?
发布于 2012-10-29 21:58:19
arguments变量是Javascript中的一个特殊变量,可在任何函数中使用。它不是真正的数组,但它包含传递给函数的参数值,可以像数组元素一样访问该函数(因此,arguments[0]是第一个参数,arguments[1]是第二个参数,依此类推)。
有关更多信息和示例,请查看Mozilla Developer Network上的this page。
https://stackoverflow.com/questions/13121011
复制相似问题