Objects can inherit properties and methods from a prototype.
Source Code
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
Person.prototype.fullName = function() {
return `${this.firstName} ${this.lastName}`;
};
let person = new Person('John', 'Doe');
console.log(person.fullName()); // John Doe