Object.prototype (Property)

The prototype for the Object object, which can be used to extend the interface for all Object objects.

Availability:

ECMAScript edition - 2
JavaScript - 1.1
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
Opera - 3.0
Property/method value type:Object object
JavaScript syntax:-Object.prototype
-myObject.constructor.prototype

The initial value of the prototype property of an Object object is the built in Object prototype object.

Object objects inherit the following properties from the Object.prototype:

Object objects inherit the following methods from their prototype:

The prototype property for the Object prototype object is null.

The example demonstrates how to provide extensions to all instances of this class by adding a function to the prototype object.

Warnings:

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <SCRIPT>
   // Define a function that extends the output capabilities of Object objects
   function init()
   {
      this.width  = 100;
      this.height = 200;
      this.depth  = 300;
      return "";
   }
   // Register the new function
   Object.prototype.init = init;
   // Create a new object
   myObject = new Object();
   myObject.init();
   document.write(myObject.width  + "<BR>");
   document.write(myObject.height + "<BR>");
   document.write(myObject.depth  + "<BR>");
   </SCRIPT>
   </BODY>
   </HTML>

See also:Arguments object, Function.arguments[], JellyScript, Object object, Object(), Object.constructor, Object.toString(), Object.valueOf(), prototype property

Property attributes:

ReadOnly, DontDelete, DontEnum.

Cross-references:

ECMA 262 edition 2 - section - 15.2.3.1

ECMA 262 edition 2 - section - 15.2.4

ECMA 262 edition 3 - section - 15.2.3.1