Object.Create
by REPLY2SAGAR
JavaScript
const prototypePerson = {
isAdult: function() {
return this.age >= 18;
},
fullName: function() {
return `${this.firstName} ${this.lastName}`;
}
};
const bob = Object.create(prototypePerson);
bob.firstName = "Sagar";
bob.lastName = "Salunke";
bob.age = 27;
console.log(bob.fullName()); // Outputs: Bob Smith
console.log(bob.isAdult()); // Outputs: true