what is the difference between Person.prototype
and Object.create(Person.prototype)
? Could I use each of them?
function Person(name) {
this.name = name;
}
Person.prototype.copy = function() {
return new this.constructor(this.name);
};
// define the Student class
function Student(name) {
Person.call(this, name);
}
// inherit Person
Student.prototype = Person.prototype;
//Student.prototype = Object.create(Person.prototype);