标签:new 拷贝 ons for copy 数组 深拷贝 function object
function copydeep(obj) {
var newobj = obj.constructor === Array ? [] : {};
if (typeof obj !== ‘object‘) {
return;
}
for (var i in obj) {
newobj[i] = typeof obj[i] === ‘object‘ ? copydeep(obj[i]) : obj[i];
}
return newobj
}
标签:new 拷贝 ons for copy 数组 深拷贝 function object
原文地址:https://www.cnblogs.com/lisaShare/p/13365606.html