标签:property === 拷贝 epc return color 复制 turn sar
1 function deepCopy(obj) { 2 var result = Array.isArray(obj) ? [] : {}; 3 for (var key in obj) { 4 if (obj.hasOwnProperty(key)) { 5 if (typeof obj[key] === ‘object‘ && obj[key]!==null) { 6 result[key] = deepCopy(obj[key]); //递归复制 7 } else { 8 result[key] = obj[key]; 9 } 10 } 11 } 12 return result; 13 }
标签:property === 拷贝 epc return color 复制 turn sar
原文地址:https://www.cnblogs.com/ajaxkong/p/11692196.html