function deepClone(obj){
var newObj= obj instanceof Array ? []:{};
for(var item in obj){
var temple= typeof obj[item] == 'object' ? deepClone(obj[item]):obj[item];
newObj[item] = temple;
}
return newObj;
}
对象深度克隆的简单实现
猜你喜欢
转载自blog.csdn.net/weixin_39418338/article/details/119850460
今日推荐
周排行