prototype  Object  class property JS Home  <<  JS Reference  <<  Object  <<  prototype

Description

Enables property assignment to objects of type Object.

  • All objects are descendants of Object.
  • All objects inherit their properties and methods from Object.prototype.
  • So when overriding an Object method such as valueOf(), you would override as follows:
    yourObject.prototype.valueOf = function functionName {your override code}
  • Like all class properties prototype should be used on the class rather than an instance of the class.

Syntax

Signature Description
Object.prototypeEnables property assignment to objects of type Object.

Parameters

None.

Examples

The code below displays Object prototype.



  alert('Object prototype is ' + Object.prototype);

Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 5 - Elegant Object Creation