JavaScript: Find Object's Prototype

By Xah Lee. Date: . Last updated: .

You can use the following ways to find a object's parent, or check if a object is in another's prototype chain.

Object.getPrototypeOf

Return the object's parent object.

〔►see JavaScript: Object.getPrototypeOf

Reflect.getPrototypeOf, (ES2015)

Return the object's parent object.

〔►see JavaScript: Reflect.getPrototypeOf

Value Property __proto__, (ES2015)

Value is the parent object.

var myArray = [4,6];
console.log( Object.getPrototypeOf (myArray)  === myArray.__proto__ ); // true

ECMAScript® 2016 Language Specification#sec-additional-properties-of-the-object.prototype-object

Object.prototype.isPrototypeOf

Return true if object is in prototype chain of another object.

〔►see JavaScript: Object.prototype.isPrototypeOf

Object and Inheritance Topic

  1. JavaScript: Object System Overview
  2. JavaScript: What's Object?
  3. JavaScript: Prototype and Inheritance
  4. JavaScript: Creating Object
  5. JavaScript: Object Literal Expression {…}
  6. JavaScript: Find Object's Prototype
  7. JavaScript: How to Create Object with Parent X?
  8. JavaScript: Prevent Adding Property
  9. JavaScript: Determine Type of Object
  10. JavaScript: Primitive Types Object Wrapper
  11. JavaScript: Clone, Deep Copy Object/Array
  12. JavaScript: Test Equality of Objects

  1. JavaScript: Object Object
  2. JavaScript: Object.prototype
Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.