function deepClone(obj){ if(obj.isArray){ var result = [] }else{ var result = {} } for(let key in obj){ if(typeof(obj[key]) == 'object'){ result[key] = deepClone(obj[key]) }else{ result[key] = obj[key] } }; return result; }
function deepClone(obj){ if(obj.isArray){ var result = [] }else{ var result = {} } for(let key in obj){ if(typeof(obj[key]) == 'object'){ result[key] = deepClone(obj[key]) }else{ result[key] = obj[key] } }; return result; }
相关阅读