JavaScript参考手册
函数 | Function
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) |
函数 | Function相关
JavaScript 是一种高级编程语言,通过解释执行,是一门动态类型,面向对象(基于原型)的解释型语言。它已经由ECMA(欧洲电脑制造商协会)通过 ECMAScript 实现语言的标准化。它被世界上的绝大多数网站所使用,也被世界主流浏览器( Chrome、IE、FireFox、Safari、Opera )支持。JavaScript 是一门基于原型、函数先行的语言,是一门多范式的语言,它支持面向对象编程,命令式编程,以及函数式编程。它提供语法来操控文本、数组、日期以及正则表达式等,不支持 I/O,比如网络
加载中,请稍侯......