SOURCE

function deepClone(obj) {
    if (!obj || typeof obj !== "object") {
        return obj;
    }
    const cloneObj = Array.isArray(obj) ? [] : {};
    for (let key in obj) {
        if (obj.hasOwnProperty(key)) {
            cloneObj[key] = deepClone(obj[key]);
        }
    }
    return cloneObj;
}
console 命令行工具 X clear

                    
>
console