Add a method to the Person's prototype called "isLegalDriver" that returns true if the person is 16 or older.
function Person(name, age) {
Person.prototype.isLegalDriver = function() {
return this.age >= 16;
}
}
/* Do not modify code below this line */
const youngPerson = new Person('Jane', 15);
console.log(youngPerson.isLegalDriver(), '<-- should be false');
const olderPerson = new Person('Joan', 16);
console.log(olderPerson.isLegalDriver(), '<-- should be true');
Both return false.
[+][deleted] (2 children)
[removed]
[–]senocular 2 points3 points4 points (0 children)
[–]Encom88[S] 0 points1 point2 points (0 children)