JS Built-ins
Prototypesbeginner

Prototypes β€” Object.getPrototypeOf basics

πŸ“– Usage Example
const obj = {};
Object.getPrototypeOf(obj) === Object.prototype; // true

Every plain object's prototype is Object.prototype at the top of the chain.

Understanding Object.getPrototypeOf

The Object.getPrototypeOf() method returns the prototype of a specified object. Every object has an internal prototype that other objects can inherit from.

Challenge: Use Object.getPrototypeOf() to verify the prototype chain and understand how objects inherit from Object.prototype.

πŸ’‘ Hints (2)
  • β€’ Object.getPrototypeOf retrieves the internal [[Prototype]]
  • β€’ Every object (except null-prototype objects) has Object.prototype at the end of the chain