Javascript中以下两种继承对象的方法有什么区别吗?
function Person(name) {
this.name = name;
}
function Student(name, id) {
Person.call(this, name);
this.id = id;
}
方法一:
Student.prototype.__proto__ = Person.prototype;
方法二:
Student.prototype = new Person;
Student.prototype.constructor = Student;