JavaScript: Object.prototype Properties

By Xah Lee. Date: . Last updated: .

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

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

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

// type of Object.prototype
console.log ( typeof Object.prototype === "object" ); // true
console.log ( 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 object inherits from Object.prototype. So, for any property x of Object.prototype, you can access it by obj.x where obj is any object. If the object obj has x as its own property, the own property is used.



Value is the function object Object.

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

〔➤see JavaScript: Property Key "constructor"

〔➤see JavaScript: Object Object Properties

Object.prototype.hasOwnProperty ( V )

JavaScript: Check Property Existence

Object.prototype.isPrototypeOf ( V )

JavaScript: Find Object's Prototype/Parent

Object.prototype.propertyIsEnumerable ( V )

Object.prototype.propertyIsEnumerable ( V )

returns true if value V is a own property key of the object in thisBinding and that property has enumerable attribute value of true.

〔➤see JavaScript: Property Attributes: Writable, Enumerable, Configurable

〔➤see JavaScript: Keyword “this”

Object.prototype.toLocaleString ( reserved1, reserved2 … )

ES2015 §Fundamental Objects#sec-object.prototype.tolocalestring

Object.prototype.toString ( )

Object.prototype.toString ()

returns a string representation of the object in thisBinding.

Often used to find out if a object is a real Object object or some other object such as date, regex, etc.

〔➤see JavaScript: Determine Type of Object

〔➤see JavaScript: Keyword “this”

ES2015 §Fundamental Objects#sec-object.prototype.tostring

Object.prototype.valueOf ( )

Object.prototype.valueOf ()

returns a value of object type, by converting the value of thisBinding to a object type.

ES2015 §Fundamental Objects#sec-object.prototype.valueof


ES2015 §Fundamental Objects#sec-properties-of-the-object-prototype-object

Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.