馬老師抽絲剝繭設(shè)計(jì)模式
class Dog {
?kind = 'dog';
?constructor(name) {
? ?this.name = name;
? ?this.legsNum = 4;
?}
?run() {
? ?console.log("I am running with " + this.legsNum + " legs.")
?}
?say() {
? ?console.log("Wang Wang, I am " + this.name);
?}}const dog = new Dog('ming');dog.say();
標(biāo)簽: