You’re reading the English version of this content since no translation exists yet for this locale. Help us translate this article!

The Object.prototype is a property of the Object constructor. It is also the end of a prototype chain.

Property attributes of Object.prototype
Writable no
Enumerable no
Configurable no


Nearly all objects in JavaScript are instances of Object; a typical object inherits properties (including methods) from Object.prototype, although these properties may be shadowed (a.k.a. overridden). However, an Object may be deliberately created for which this is not true (e.g. by Object.create(null)), or it may be altered so that this is no longer true (e.g. with Object.setPrototypeOf).

Changes to the Object prototype object are seen by all objects through prototype chaining, unless the properties and methods subject to those changes are overridden further along the prototype chain. This provides a very powerful although potentially dangerous mechanism to override or extend object behavior.


Specifies the function that creates an object's prototype.
Points to the object which was used as prototype when the object was instantiated.
Allows a function to be defined that will be executed when an undefined object member is called as a method.
Used to return the number of enumerable properties directly on a user-defined object, but has been removed.
Used to point to an object's context, but has been removed.


Associates a function with a property that, when accessed, executes that function and returns its return value.
Associates a function with a property that, when set, executes that function which modifies the property.
Returns the function associated with the specified property by the __defineGetter__() method.
Returns the function associated with the specified property by the __defineSetter__() method.
Returns a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain.
Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object.
Returns a boolean indicating if the internal ECMAScript [[Enumerable]] attribute is set.
Returns string containing the source of an object literal representing the object that this method is called upon; you can use this value to create a new object.
Calls toString().
Returns a string representation of the object.
Removes a watchpoint from a property of the object.
Returns the primitive value of the specified object.
Adds a watchpoint to a property of the object.
Used to evaluate a string of JavaScript code in the context of the specified object, but has been removed.


When altering the behavior of existing Object.prototype methods, consider injecting code by wrapping your extension before or after the existing logic. For example, this (untested) code will pre-conditionally execute custom logic before the built-in logic or someone else's extension is executed.

When a function is called, the arguments to the call are held in the array-like "variable" arguments. For example, in the call "myFn(a, b, c)", the arguments within myFn's body will contain 3 array-like elements corresponding to (a, b, c). When modifying prototypes with hooks, simply pass this & the arguments (the call state) to the current behavior by calling apply() on the function. This pattern can be used for any prototype, such as Node.prototype, Function.prototype, etc.

var current = Object.prototype.valueOf;

// Since my property "-prop-value" is cross-cutting and isn't always
// on the same prototype chain, I want to modify Object.prototype: 
Object.prototype.valueOf = function() {
  if (this.hasOwnProperty('-prop-value')) {
    return this['-prop-value'];
  } else {
    // It doesn't look like one of my objects, so let's fall back on 
    // the default behavior by reproducing the current behavior as best we can.
    // The apply behaves like "super" in some other languages.
    // Even though valueOf() doesn't take arguments, some other hook may.
    return current.apply(this, arguments);

Since JavaScript doesn't exactly have sub-class objects, prototype is a useful workaround to make a “base class” object of certain functions that act as objects. For example:

var Person = function(name) {
  this.name = name;
  this.canTalk = true;

Person.prototype.greet = function() {
  if (this.canTalk) {
    console.log('Hi, I am ' + this.name);

var Employee = function(name, title) {
  Person.call(this, name);
  this.title = title;

Employee.prototype = Object.create(Person.prototype);
Employee.prototype.constructor = Employee; //If you don't set Object.prototype.constructor to Employee, 
                                           //it will take prototype.constructor of Person (parent). 
                                           //To avoid that, we set the prototype.constructor to Employee (child).

Employee.prototype.greet = function() {
  if (this.canTalk) {
    console.log('Hi, I am ' + this.name + ', the ' + this.title);

var Customer = function(name) {
  Person.call(this, name);

Customer.prototype = Object.create(Person.prototype);
Customer.prototype.constructor = Customer; //If you don't set Object.prototype.constructor to Customer, 
                                           //it will take prototype.constructor of Person (parent). 
                                           //To avoid that, we set the prototype.constructor to Customer (child).

var Mime = function(name) {
  Person.call(this, name);
  this.canTalk = false;

Mime.prototype = Object.create(Person.prototype);
Mime.prototype.constructor = Mime; //If you don't set Object.prototype.constructor to Mime,
                                   //it will take prototype.constructor of Person (parent).
                                   //To avoid that, we set the prototype.constructor to Mime (child).

var bob = new Employee('Bob', 'Builder');
var joe = new Customer('Joe');
var rg = new Employee('Red Green', 'Handyman');
var mike = new Customer('Mike');
var mime = new Mime('Mime');

// Hi, I am Bob, the Builder

// Hi, I am Joe

// Hi, I am Red Green, the Handyman

// Hi, I am Mike



Specification Status Comment
ECMAScript Latest Draft (ECMA-262)
The definition of 'Object.prototype' in that specification.
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'Object.prototype' in that specification.
ECMAScript 5.1 (ECMA-262)
The definition of 'Object.prototype' in that specification.
ECMAScript 1st Edition (ECMA-262) Standard Initial definition. Implemented in JavaScript 1.0.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
prototypeChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes


Full support  
Full support

See also