// ES6 中的 for of 方式 + keys() + 递归实现深拷贝
const deepClone = (obj) => {
if (obj === null) return null;
let clone = obj instanceof Array ? [] : {};
for (const key of Object.keys(obj)) {
clone[key] = typeof obj[key] === "object" ? deepClone(obj[key]) : obj[key];
}
return clone;
}
05-02
07-12
2429
10-14
3389
04-30
384