对象深度克隆的简单实现
作者:互联网
function deepClone(obj){
var newObj = obj instanceof Array ? [] : {}
for (var item in obj) {
var temple = typeof obj[item] == 'object ? deppClone(obj[item]) : obj[item]
newObj[item] = temple
}
return newObj
}
标签:function,obj,克隆,对象,newObj,item,深度,var,temple 来源: https://www.cnblogs.com/suihung/p/16218457.html