Prototypal inheritance

Domains: Javascript

  • Is a language feature that helps in we often want to take something and extend it.
  • Is only used for reading properties.
  • In JavaScript, all objects have a hidden Prototype property that's either another object or null.

Syntax

Let animal = {
  eats: true
};
let rabbit = {
  jumps: true
};

*!*
rabbit.__proto__ = animal;
*/!*

Prototypal inheritance — Structure map

Clickable & Draggable!

Prototypal inheritance — Related pages: