Revision: 14327
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 30, 2009 02:30 by iTony
Initial Code
function deepCopy(obj) {
if (Object.prototype.toString.call(obj) === '[object Array]') {
var out = [], i = 0, len = obj.length;
for ( ; i < len; i++ ) {
out[i] = arguments.callee(obj[i]);
}
return out;
}
if (typeof obj === 'object') {
var out = {}, i;
for ( i in obj ) {
out[i] = arguments.callee(obj[i]);
}
return out;
}
return obj;
}
Initial URL
http://james.padolsey.com/javascript/deep-copying-of-objects-and-arrays/
Initial Description
Initial Title
Deep Copy an Array or Object
Initial Tags
javascript, array
Initial Language
JavaScript