JS Built-ins
← Object127 / 150
ObjectisPrototypeOfintermediate

isPrototypeOf() β€” deeper chain

πŸ“– Usage Example
// Check prototype chain membership
const proto = {}
const child = Object.create(proto)
proto.isPrototypeOf(child)   // β†’ true
Object.prototype.isPrototypeOf(child)  // β†’ true

Use isPrototypeOf() to check whether an object exists anywhere in the prototype chain of another object.

isPrototypeOf() β€” multi-level chain

isPrototypeOf() checks the entire chain, not just the immediate prototype. So if A β†’ B β†’ C, A.isPrototypeOf(C) returns true.

Challenge: Verify that isPrototypeOf works across multiple levels.

πŸ’‘ Hints (1)
  • β€’ isPrototypeOf checks the entire chain, not just the immediate parent