clone :: Object |
Do note that this is shallow copy, not deep copy.
Examples
var o = { name: 'Prototype', version: 1.5, authors: ['sam', 'contributors'] }; var o2 = Object.clone(o);
o2.version = '1.5 weird'; o2.authors.pop();
o.version // -> 1.5
o2.version // -> '1.5 weird'
o.authors // -> ['sam'] // Ouch! Shallow copy!
|
Prototype API 1.5.0 - prototypejs.org