Code
Completed Code
Add this below your existing code.
function Parent(firstName, lastName, gender, age, birthday, isMarried, occupation) {
Person.call(this, firstName, lastName, gender, age, birthday);
this.isMarried = isMarried;
this.occupation = occupation;
}
Parent.prototype = Object.create(Person.prototype);
Parent.prototype.constructor = Parent;
Parent.prototype.job = function () {
if (this.pronoun().toLowerCase() == "he" || this.pronoun().toLowerCase() == "she") {
return (this.pronoun() + " is a/an " + this.occupation + ".");
} else {
return (this.pronoun() + " are a/an " + this.occupation + ".");
}
};
var parent1 = new Parent ('Jane', 'Jovi', 'female', 29, 'May 9', true, 'coder');
console.log(parent1);
console.log(parent1.job());Output
Last updated