深克隆
/**
* 深克隆
*/
function deepClone(obj) {
if(obj === null) return null;
if(typeof obj !== 'object') return obj;
var newObj = obj instanceof Array ? [] : {};
newObj.constructor = obj.constructor;
for(var i in obj) {
if(obj.hasOwnPropety(i)){
newObj[i] = typeof obj[i] === 'object' ? deepClone(obj[i]) : obj[i];
}
}
return newObj;
}