JavaScript: Object.prototype

By Xah Lee. Date: . Last updated: .

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

〔►see JavaScript: Object Object

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

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

〔►see JavaScript: 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 JavaScript: 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.

Properties


Object.prototype.constructor

Object.prototype.constructor

Value is the function object Object.

〔►see JavaScript: Property Key "constructor"

〔►see JavaScript: Object Object

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

Object.prototype.hasOwnProperty

〔►see JavaScript: Object.prototype.hasOwnProperty

Object.prototype.isPrototypeOf

〔►see JavaScript: Object.prototype.isPrototypeOf

Object.prototype.propertyIsEnumerable

〔►see JavaScript: Object.prototype.propertyIsEnumerable

Object.prototype.toString

〔►see JavaScript: Object.prototype.toString

Object.prototype.toLocaleString

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

Object.prototype.valueOf

〔►see JavaScript: Object.prototype.valueOf

Reference

ECMAScript 2015 §Fundamental Objects#sec-object.prototype

Object and Inheritance Topic

  1. JavaScript: Object System Overview
  2. JavaScript: What's Object?
  3. JavaScript: Prototype and Inheritance
  4. JavaScript: Create 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 Value 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.