3 ms·
Wow, the example is atrocious, Person.prototype.getAge = function (birthYear) { var age = 2015; age -= birthYear; return result; // Do you m
by tantalor 11y ago
Wow, the example is atrocious,
Person.prototype.getAge = function (birthYear) {
var age = 2015;
age -= birthYear;
return result;
// Do you mean return age?
};
Object.defineProperty(Person.prototype, 'age', {
get: function () {
return this.getAge();
// getAge function takes a required parameter.
}
});