var source = new Array();
source[0] = '1';
source[1] = '2';
source[2] = '3';
var destination = new Array();
destination[0] = '4';
destination[1] = '5';
destination[2] = '6';
destination[3] = '7';
destination[4] = '8';
destination[5] = '9';
// Ext.apply(obj1,obj2) copy all properties of obj2 to obj1 any way,replaceing
// the ones that obj1 has already defined
Ext.apply(destination,source);
document.write(destination + '<br/>'); // 1,2,3,7,8,9
// Ext.applyIf(obj1,obj2) copy all properties of obj2 to obj1 only if
// they don't already exist
Ext.applyIf(destination,source);
document.write(destination + '<br/>'); // 4,5,6,7,8,9
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment