Discuss / JavaScript / show一波操作

show一波操作

Topic source
class Animal {
    constructor(name) {
        this.name = name;    }
}

class Cat extends Animal {
    say() {
        return 'hello, ' + this.name;    }
}

var cat2 = new Cat('ketty');
console.log(cat2.say()); //hello, ketty

  • 1

Reply