function Child(firstName, lastName, gender, age, birthday, grade, interests) {
Person.call(this, firstName, lastName, gender, age, birthday);
this.grade = grade;
this.interests = interests;
}
Child.prototype = Object.create(Person.prototype);
Child.prototype.constructor = Child;
Child.prototype.intro = function () {
return (this.fullName() + ' is a/an ' + this.age + "-year-old " + this.ordinalSuffix(this.grade) + " grader.");
};
Child.prototype.enjoy = function () {
if (this.pronoun().toLowerCase() == "he" || this.pronoun().toLowerCase() == "she") {
return (this.firstName + "'s birthday is " + this.birthday + " and " + this.pronoun().toLowerCase() + " enjoys " + this.interests + ".");
} else {
return (this.firstName + "'s birthday is " + this.birthday + " and " + this.pronoun().toLowerCase() + " enjoy " + this.interests + ".");
}
};
var child1 = new Child ('Bon', 'Jovi', 'male', 6, 'March 2', 1, 'singing and dancing');
console.log(child1);
console.log(child1.intro());
console.log(child1.enjoy());
Child {
firstName: 'Bon',
lastName: 'Jovi',
gender: 'male',
age: 6,
birthday: 'March 2',
nextYear: 7,
fullName: [Function],
pronoun: [Function],
possessive: [Function],
ordinalSuffix: [Function],
grade: 1,
interests: 'singing and dancing' }
Bon Jovi is a/an 6-year-old 1st grader.
Bon's birthday is March 2 and he enjoys singing and dancing.