摘要:
1 Object.prototype.clone = function() { 2 var copy = (this instanceof Array) ? [] : {}; 3 for (attr in this) { 4 if (!obj.hasOwnProperty(attr)) continue; 5 copy[attr] = (typeof this[i] == "object")?obj[attr].clone():obj[attr]; 6 } 7 return copy; 8 }; 9 10 11 a = {k1:1, k2:2, k3:3};...
阅读全文