function Animate() {
this.age = 12
}
Animate.prototype = {
say() {
console.log(this.age)
}
}
new Animate().say()
function Dog() {}
Dog.prototype = Animate.prototype// 請問這個也可以用Object.create(Animate.prototype),那么用和不用有什么區別嗎,求解
let dog = new Dog()
dog.say()
js原型式繼承的一個問題?
蕭十郎
2018-07-30 10:22:14