SOURCE

class People {
    constructor(name, gender) {
        this.name = name;
        this.gender = gender;
    }
    fun() {
        return "My name is " + this.name + "  and  " + this.gender;
    }
}


class M extends People {
    constructor(name, gender) {
        super(name, gender);
    }
}

let people = new M("ming", "man");
let people2 = new M("hong", "girl");
console.log(people);
console.log(people2);
console.log(people.fun());

console 命令行工具 X clear

                    
>
console