function Animal(name){ this.name = name; this.showName = function(){ console.log(this.name); } this.bark=function(){ console.log(this.name+"animal is barking"); }; } function Dog(name){ Animal.call(this, name); this.bark=function(){ console.log(this.name+" is barking wang wang~"); }; } var cat = new Dog("Husky"); cat.bark();
JS对象继承
最新推荐文章于 2023-12-27 10:41:34 发布