Revision 492249 of Function.prototype

  • Revision slug: Web/JavaScript/Reference/Global_Objects/Function/prototype
  • Revision title: Function.prototype
  • Revision id: 492249
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

{{JSRef("Global_Objects", "Function")}}

Summary

The Function.prototype property represents the {{jsxref("Global_Objects/Function", "Function")}} prototype object.

Description

Function objects inherit from Function.prototypeFunction.prototype cannot be modified.

Properties

{{jsxref("Function.arguments")}} {{deprecated_inline()}}
An array corresponding to the arguments passed to a function. This is deprecated as property of Function, use the {{jsxref("Functions_and_function_scope/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")}} {{ Non-standard_inline() }}
The name of the function.
Function.prototype.constructor
Specifies the function that creates an object's prototype. See {{jsxref("Object.constructor")}} for more details.
{{ jsOverrides("Object", "properties", "arguments", "arity", "caller", "constructor", "length", "name") }}

Methods

{{jsxref("Function.prototype.apply()")}}
Applies the method of another object in the context of a different object (the calling object); arguments can be passed as an Array object.
{{jsxref("Function.prototype.bind()")}}
Creates a new function which, when called, itself calls this function in the context of 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 method of another object in the context of a different object (the calling object); arguments can be passed as they are.
{{jsxref("Function.prototype.isGenerator()")}}
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.toSource")}} method.
{{jsxref("Function.prototype.toString()")}}
Returns a string representing the source code of the function. Overrides the {{jsxref("Object.toString")}} method.
{{ jsOverrides("Object", "methods", "apply", "call", "toSource", "toString") }}

Specifications

Specification Status Comment
ECMAScript 1st Edition. Implemented in JavaScript 1.1 Standard Initial definition.
{{SpecName('ES5.1', '#sec-15.3.3.1', 'Function.prototype')}}
For Function instances:
{{SpecName('ES5.1', '#sec-15.3.5.2', 'Function.prototype')}}
{{Spec2('ES5.1')}}  
{{SpecName('ES6', '#sec-function.prototype', 'Function.prototype')}}
For Function instances:
{{SpecName('ES6', '#sec-function-instances-prototype', 'Function.prototype')}}
{{Spec2('ES6')}}  

Browser compatibility

{{ 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() }}

See also

  • {{jsxref("Global_Objects/Function", "Function")}}

Revision Source

<div>
 {{JSRef("Global_Objects", "Function")}}</div>
<h2 id="Summary" name="Summary">Summary</h2>
<p>The <code><strong>Function.prototype</strong></code> property represents the {{jsxref("Global_Objects/Function", "Function")}} prototype object.</p>
<h2 id="Description" name="Description">Description</h2>
<p><code>Function</code> objects inherit from <code>Function.prototype</code>.&nbsp; <code>Function.prototype</code> cannot be modified.</p>
<h2 id="Properties" name="Properties">Properties</h2>
<dl>
 <dt>
  {{jsxref("Function.arguments")}} {{deprecated_inline()}}</dt>
 <dd>
  An array corresponding to the arguments passed to a function. This is deprecated as property of <code>Function</code>, use the {{jsxref("Functions_and_function_scope/arguments", "arguments")}} object available within the function instead.</dd>
 <dt>
  <s class="obsoleteElement">{{jsxref("Function.arity")}} {{obsolete_inline() }}</s></dt>
 <dd>
  <s class="obsoleteElement">Used to specifiy the number of arguments expected by the function, but has been removed. Use the {{jsxref("Function.length", "length")}} property instead.</s></dd>
 <dt>
  {{jsxref("Function.caller")}} {{ Non-standard_inline() }}</dt>
 <dd>
  Specifies the function that invoked the currently executing function.</dd>
 <dt>
  {{jsxref("Function.length")}}</dt>
 <dd>
  Specifies the number of arguments expected by the function.</dd>
 <dt>
  {{jsxref("Function.name")}} {{ Non-standard_inline() }}</dt>
 <dd>
  The name of the function.</dd>
 <dt>
  Function.prototype.constructor</dt>
 <dd>
  Specifies the function that creates an object's prototype. See {{jsxref("Object.constructor")}} for more details.</dd>
</dl>
<div>
 {{ jsOverrides("Object", "properties", "arguments", "arity", "caller", "constructor", "length", "name") }}</div>
<h2 id="Methods" name="Methods">Methods</h2>
<dl>
 <dt>
  {{jsxref("Function.prototype.apply()")}}</dt>
 <dd>
  Applies the method of another object in the context of a different object (the calling object); arguments can be passed as an Array object.</dd>
 <dt>
  {{jsxref("Function.prototype.bind()")}}</dt>
 <dd>
  Creates a new function which, when called, itself calls this function in the context of the provided value, with a given sequence of arguments preceding any provided when the new function was called.</dd>
 <dt>
  {{jsxref("Function.prototype.call()")}}</dt>
 <dd>
  Calls (executes) a method of another object in the context of a different object (the calling object); arguments can be passed as they are.</dd>
 <dt>
  {{jsxref("Function.prototype.isGenerator()")}}</dt>
 <dd>
  Returns <code>true</code> if the function is a <a href="/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators">generator</a>; otherwise returns <code>false</code>.</dd>
 <dt>
  {{jsxref("Function.prototype.toSource()")}} {{ Non-standard_inline() }}</dt>
 <dd>
  Returns a string representing the source code of the function. Overrides the {{jsxref("Object.toSource")}} method.</dd>
 <dt>
  {{jsxref("Function.prototype.toString()")}}</dt>
 <dd>
  Returns a string representing the source code of the function. Overrides the {{jsxref("Object.toString")}} method.</dd>
</dl>
<div>
 {{ jsOverrides("Object", "methods", "apply", "call", "toSource", "toString") }}</div>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>ECMAScript 1st Edition. Implemented in JavaScript 1.1</td>
   <td>Standard</td>
   <td>Initial definition.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.3.3.1', 'Function.prototype')}}<br />
    For Function instances:<br />
    {{SpecName('ES5.1', '#sec-15.3.5.2', 'Function.prototype')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-function.prototype', 'Function.prototype')}}<br />
    For Function instances:<br />
    {{SpecName('ES6', '#sec-function-instances-prototype', 'Function.prototype')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Chrome</th>
    <th>Firefox (Gecko)</th>
    <th>Internet Explorer</th>
    <th>Opera</th>
    <th>Safari</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
   </tr>
  </tbody>
 </table>
</div>
<div id="compat-mobile">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Android</th>
    <th>Chrome for Android</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>IE Mobile</th>
    <th>Opera Mobile</th>
    <th>Safari Mobile</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
    <td>{{ CompatVersionUnknown() }}</td>
   </tr>
  </tbody>
 </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
 <li>{{jsxref("Global_Objects/Function", "Function")}}</li>
</ul>
Revert to this revision