I`m learning function constructor at the moment. This seems to work fine.
Person.prototype.calculateAge = function () {
console.log(2020 - this.yearOfBirth);
};
Linter doesn`t like when I use anonymous functions and offers arrow functions instead. When I modify it:
Person.prototype.calculateAge = () => {
console.log(2020 - this.yearOfBirth);
};
I get NaN. Thank you for your help!