SOURCE

function deepCopy(obj, newObj){
    var newObj = newObj || {};

    for(var key in obj){
        if(typeof obj[key] == 'object'){
            if(obj[key].constructor == Array){
                newObj[key] = []
            }else{
                newObj[key] = {}
            }
            deepCopy(obj[key], newObj[key]);
        }else{
            newObj[key] = obj[key]
        }
    }
    return newObj;
}

var obj = {
    a:1,
    b:[],
    c:{
        c1:'c1'
    },
    d:['c1','c2','c3']
}
var one = deepCopy(obj);
one.a = 2;
one.b = [1,2]
console.log(JSON.stringify(obj))
console.log(JSON.stringify(one));

class Person {
    name = 'jack'
    getName() { return this.name; }
    static age = 10
    static getAge() {return this.age}
}
var person = new Person()
console.log(Person.getAge());
console 命令行工具 X clear

                    
>
console