利用构造函数实现继承

133 阅读1分钟
function Person(name,age) {
    this.name: name,
    this.age: age
}
function Student(name,age,score) {
    Person.call(this,name,age)
    <!--Person.apply(this,[name,age])-->
    <!--Person.bind(this,name,age)()-->
    this.score = score
}
var student1 = new Student('火星娃',18,80)
console.log(student1)