I have the following code:
const Person = function (firstName, birthYear) {
this.firstName = firstName;
this.birthYear = birthYear;
};
Person.prototype.calcAge = function () {
console.log(2037 - this.birthYear);
};
const Student = function (firstName, birthYear, course) {
Person.call(this, firstName, birthYear);
this.course = course;
};
// Linking prototypes
Student.prototype = Object.create(Person.prototype);
when i'm printing to console :
Student.prototype
I'm getting an empty object {} When i'm printing to console:
Student.prototype.proto
shouldn't i get undefined here??