JavaScript

What is prototype inheritance?

Hard
4
Added
Objects inherit properties/methods from prototype objects through prototype chain.

Solution Code

JavaScript
function Person() {}
Person.prototype.greet = () => console.log('hi');
Explanation
JavaScript uses prototypal inheritance rather than classical inheritance.

Guided Hints

What is __proto__ property?
How to create inheritance?