Is there any difference between the following two methods of inheriting objects in Javascript?
function Person(name) {
this.name = name;
}
function Student(name, id) {
Person.call(this, name);
this.id = id;
}
Method 1:
Student.prototype.__proto__ = Person.prototype;
Method 2:
Student.prototype = new Person;
Student.prototype.constructor = Student;
constructorattribute is of any use.