首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Function.prototype

Function.prototype属性存储了Function的原型对象。

描述

Function对象继承自 Function.prototype 属性。因此,Function.prototype不能被修改。

属性

Function.arguments以数组形式获取传入函数的所有参数。此属性已被arguments替代。Function.arity用于指定的函数的参数的个数,但已被删除。使用length属性代替。

Function.caller获取调用函数的具体对象。

Function.length获取函数的接收参数个数。

Function.name获取函数的名称。

Function.displayName获取函数的display name。

Function.prototype.constructor声明函数的原型构造方法,详细请参考Object.constructor

方法

Function.prototype.apply()在一个对象的上下文中应用另一个对象的方法;参数能够以数组形式传入。

Function.prototype.bind()bind()方法会创建一个新函数,称为绑定函数.当调用这个绑定函数时,绑定函数会以创建它时传入 bind()方法的第一个参数作为 this,传入 bind()方法的第二个以及以后的参数加上绑定函数运行时本身的参数按照顺序作为原函数的参数来调用原函数.

Function.prototype.call()在一个对象的上下文中应用另一个对象的方法;参数能够以列表形式传入。

Function.prototype.isGenerator()若函数对象为generator,返回true,反之返回false

Function.prototype.toSource()获取函数的实现源码的字符串。 覆盖了Object.prototype.toSource方法。

Function.prototype.toString()获取函数的实现源码的字符串。覆盖了Object.prototype.toString方法。

规范

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

ECMAScript Latest Draft (ECMA-262)The definition of 'Function.prototype' in that specification.

Living Standard

浏览器兼容性

Feature

Chrome

Edge

Firefox (Gecko)

Internet Explorer

Opera

Safari

Basic support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

Feature

Android

Chrome for Android

Edge

Firefox Mobile (Gecko)

IE Mobile

Opera Mobile

Safari Mobile

Basic support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

扫码关注腾讯云开发者

领取腾讯云代金券