深拷贝
function deepCopy(target){
if( typeof target !== "object" ) return;
//判断目标类型,来创建返回值
var newObj = target instanceof Array? [] : {}
for(var item in target){
//只复制元素自身的属性,不复制原型链上的
if(target.hasOwnProperty(item)){
newObj[item] = typeof target[item]=="object" ?
deepCopy(target[item]) : target[item]
}
}
return newObj
}