Overview

let animal = {
  eats: true
};
let rabbit = {
  jumps: true
};
// Sets animal to be a prototype of rabbit.
rabbit.__proto__ = animal;

// we can find both properties in rabbit now:
console.log(rabbit.eats); // "true" from animal
console.log(rabbit.jumps); // true
let animal = {
  eats: true,
  walk() {
    alert("Animal walk");
  }
};

let rabbit = {
  jumps: true,
  __proto__: animal
};

// walk is taken from the prototype
rabbit.walk(); // Animal walk
  1. The references can’t go in circles.
  2. The value of __proto__ can be either an object or null, other types (like primitives) are ignored.

The value of “this”