While learning ExtJS 4, I found out that while defining a new class, in the initComponent method the constructor of the parent class can be called using this.callParent(arguments).
I would like to know where this arguments variable (I know it can be args or a or arg too) is defined, and where its value is assigned.
For example, if I define my class as follows:
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);
}
});
Does anyone know where this arguments variable is defined, and how values are assigned to it?
The arguments variable is a special variable in Javascript, available within any function. It's not a true array, but it contains the argument values passed to the function which can be accessed like array elements (so, arguments[0] is the first argument, arguments[1] is the second, and so on).
Check out this page on the Mozilla Developer Network for more information and examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With