Javascriptでオブジェクトを継承する次の2つの方法に違いはありますか?
function Person(name) {
this.name = name;
}
function Student(name, id) {
Person.call(this, name);
this.id = id;
}
方法1:
Student.prototype.__proto__ = Person.prototype;
方法2:
Student.prototype = new Person;
Student.prototype.constructor = Student;