Deze vertaling is niet volledig. Help dit artikel te vertalen vanuit het Engels.
Function.prototype is een eigenschap die het Function prototype object representeert.
Description
Function objecten erven van Function.prototype. Function.prototype kan niet worden gewijzigd.
Properties
Function.arguments- Een array die correspondeert met de argumenten die een functie doorgegeven krijgt. Dit is veroudered als eigenschap van
Function, gebruik in plaats daarvan hetargumentsobject dat binnen de functie beschikbaar is. Function.arityUsed to specifiy the number of arguments expected by the function, but has been removed. Use thelengthproperty instead.Function.caller- Specifies the function that invoked the currently executing function.
Function.length- Specifies the number of arguments expected by the function.
Function.name- The name of the function.
Function.displayName- The display name of the function.
Function.prototype.constructor- Specifies the function that creates an object's prototype. See
Object.prototype.constructorfor more details.
Methods
Function.prototype.apply()- Calls a function and sets its this to the provided value, arguments can be passed as an
Arrayobject. Function.prototype.bind()- Creates a new function which, when called, has its this set to the provided value, with a given sequence of arguments preceding any provided when the new function was called.
Function.prototype.call()- Calls (executes) a function and sets its this to the provided value, arguments can be passed as they are.
Function.prototype.isGenerator()- Returns
trueif the function is a generator; otherwise returnsfalse. Function.prototype.toSource()- Returns a string representing the source code of the function. Overrides the
Object.prototype.toSourcemethod. Function.prototype.toString()- Returns a string representing the source code of the function. Overrides the
Object.prototype.toStringmethod.
Specifications
| Specification | Status | Comment |
|---|---|---|
| ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. Implemented in JavaScript 1.1 |
| ECMAScript 5.1 (ECMA-262) The definition of 'Function.prototype' in that specification. |
Standard | |
| ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Function.prototype' in that specification. |
Standard |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |