简单的继承
function Pet(word) {
this.word = word
this.speak = function () {
console.log(this.word)
}
}
function Dog(word) {
Pet.call(this,word)
// Pet.apply(this, arguments)
}
var dog = new Dog('汪汪')
dog.speak()
简单的继承
function Pet(word) {
this.word = word
this.speak = function () {
console.log(this.word)
}
}
function Dog(word) {
Pet.call(this,word)
// Pet.apply(this, arguments)
}
var dog = new Dog('汪汪')
dog.speak()