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:
Function.prototype
Function.constructor
The following methods are inherited from the Function.prototype:
Function.toString()
The following properties are provided by the instances of the Function object:
Function.length
The example demonstrates how to provide extensions to all instances of this class by adding a function to the prototype object.
<HTML> <HEAD> </HEAD> <BODY> <SCRIPT> // 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);"); document.write(myFunction.sourceDump()); </SCRIPT> </BODY> </HTML>
ECMA 262 edition 2 - section - 15
ECMA 262 edition 2 - section - 15.3.2.1
ECMA 262 edition 2 - section - 15.3.3.1
ECMA 262 edition 2 - section - 15.3.4
ECMA 262 edition 2 - section - 15.3.5.2
ECMA 262 edition 3 - section - 15.3
Prev | Home | Next |
Function.length | Up | Function.toSource() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |