JS: Object.prototype

By Xah Lee. Date: . Last updated: .

Object.prototype is the value of the property key "prototype" of the function Object.

[see JS: Object Object]

console.log( Object.hasOwnProperty ( "prototype" ) ); // true

Type of Object.prototype is object. That is, same type as {}.

[see JS: Data Types]

// type of Object.prototype
console.log ( typeof Object.prototype === "object" ); // true
console.log ( Object.prototype.toString.call( Object.prototype ) === "[object Object]" ) // true

Object.prototype is the root parent of all standard objects.

Parent of Object.prototype is null.

// parent of Object.prototype
console.log ( Object.getPrototypeOf ( Object.prototype ) === null ); // true

[see JS: Prototype and Inheritance]

All standard objects inherit from Object.prototype. So, for any property key k of Object.prototype, you can access it by obj.k where obj is any object. If the object obj has k as its own property, the own property is used.




Value is the function object Object.

[see JS: Property Key "constructor"]

[see JS: Object Object]

console.log(Object.prototype.constructor === Object); // true
console.log({}.constructor === Object); // true


[see JS: Object.prototype.hasOwnProperty]


[see JS: Object.prototype.isPrototypeOf]


[see JS: Object.prototype.propertyIsEnumerable]


[see JS: Object.prototype.toString]


ECMAScript 2015 §Fundamental Objects#sec-object.prototype.tolocalestring


[see JS: Object.prototype.valueOf]


ECMAScript 2015 §Fundamental Objects#sec-object.prototype

Object and Inheritance Topic

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

  1. JS: Object Object
  2. JS: Object.prototype
Liket it? Put $1 at patreon.

Or, Buy JavaScript in Depth