Inheritance

JavaScript Prototypes for the Confused

Objects can have a prototype and a prototype is just another object. We can get an object’s prototype using the Object.getPrototypeOf method. Object.getPrototypeOf({}); // → {} Yes, JavaScript really loves objects. It’s objects all the way down. Actually that’s not completely true: Object.getPrototypeOf(Object.getPrototypeOf({})); // → null The first call to Object.getPrototypeOf gave us the prototypical object—the one that acts as the prototype for practically all objects—and calling Object.