Function.prototype (Property)

The prototype for the Function object that can be used to extend the interface for all Function objects.


ECMAScript edition - 2
JavaScript - 1.1
JScript - 1.0
Internet Explorer - 3.02
Netscape - 3.0
Netscape Enterprise Server - 2.0
Opera - 3.0
Property/method value type:Function object
JavaScript syntax:-Function.prototype

This is the prototype function object belonging to the global object and from which all Function objects are descended.

The initial value of Function.prototype is the built-in Function prototype object.

The value of the prototype property of a function is used to initialize child objects when that function is used as a constructor.

The following properties are inherited from the Function.prototype:

The following methods are inherited from the Function.prototype:

The following properties are provided by the instances of the Function object:

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

Example code:

   // Define a function that extends the output capabilities of Function objects
   function sourceDump()
      myString = this.toString();
      myArray  = myString.split("{");
      myString = myArray.join("<BR>{<BR>");
      myArray  = myString.split("}");
      myString = myArray.join("<BR>}<BR>");
      return myString;
   // Register the new function
   Function.prototype.sourceDump = sourceDump;
   // Create a function and test the Function.sourceDump() method
   var myFunction = new Function("arg1, arg2", "return(arg1 * arg2);");

See also:Function call, Function object, Function(), Function(), Function.arity, Function.constructor, Function.length, Function.toString(), prototype property

Property attributes:

ReadOnly, DontDelete, DontEnum.


ECMA 262 edition 2 - section - 15

ECMA 262 edition 2 - section -

ECMA 262 edition 2 - section -

ECMA 262 edition 2 - section - 15.3.4

ECMA 262 edition 2 - section -

ECMA 262 edition 3 - section - 15.3