我们先回顾Student
构造函数:
function Student(props) {
this.name = props.name || 'Unnamed';
}
Student.prototype.hello = function () {
alert('Hello, ' + this.name + '!');
}
以及Student
的原型链:
只有函数才有prototype属性。
function Person(){ this.live = true; }