--- title: Function.prototype slug: conflicting/Web/JavaScript/Reference/Global_Objects/Function translation_of: Web/JavaScript/Reference/Global_Objects/Function translation_of_original: Web/JavaScript/Reference/Global_Objects/Function/prototype original_slug: Web/JavaScript/Reference/Global_Objects/Function/prototype ---
{{JSRef}}

Function.prototype 屬性表示 {{jsxref("Function")}} 的原型物件。

描述

{{jsxref("Function")}} objects inherit from Function.prototypeFunction.prototype cannot be modified.

屬性

{{jsxref("Function.arguments")}} {{deprecated_inline}}
An array corresponding to the arguments passed to a function. This is deprecated as property of {{jsxref("Function")}}, use the {{jsxref("Functions/arguments", "arguments")}} object available within the function instead.
{{jsxref("Function.arity")}} {{obsolete_inline}}
Used to specifiy the number of arguments expected by the function, but has been removed. Use the {{jsxref("Function.length", "length")}} property instead.
{{jsxref("Function.caller")}} {{non-standard_inline}}
Specifies the function that invoked the currently executing function.
{{jsxref("Function.length")}}
Specifies the number of arguments expected by the function.
{{jsxref("Function.name")}}
The name of the function.
{{jsxref("Function.displayName")}} {{non-standard_inline}}
The display name of the function.
Function.prototype.constructor
Specifies the function that creates an object's prototype. See {{jsxref("Object.prototype.constructor")}} for more details.

方法

{{jsxref("Function.prototype.apply()")}}
Calls a function and sets its this to the provided value, arguments can be passed as an {{jsxref("Array")}} object.
{{jsxref("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.
{{jsxref("Function.prototype.call()")}}
Calls (executes) a function and sets its this to the provided value, arguments can be passed as they are.
{{jsxref("Function.prototype.isGenerator()")}} {{non-standard_inline}}
Returns true if the function is a generator; otherwise returns false.
{{jsxref("Function.prototype.toSource()")}} {{non-standard_inline}}
Returns a string representing the source code of the function. Overrides the {{jsxref("Object.prototype.toSource")}} method.
{{jsxref("Function.prototype.toString()")}}
Returns a string representing the source code of the function. Overrides the {{jsxref("Object.prototype.toString")}} method.

規範

Specification Status Comment
{{SpecName('ES1')}} {{Spec2('ES1')}} Initial definition. Implemented in JavaScript 1.1
{{SpecName('ES5.1', '#sec-15.3.5.2', 'Function.prototype')}} {{Spec2('ES5.1')}}  
{{SpecName('ES6', '#sec-function-instances-prototype', 'Function.prototype')}} {{Spec2('ES6')}}  
{{SpecName('ESDraft', '#sec-function-instances-prototype', 'Function.prototype')}} {{Spec2('ESDraft')}}  

瀏覽器相容性

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

參見