diff options
Diffstat (limited to 'files/zh-cn/conflicting/web/javascript/reference/global_objects/function/index.html')
-rw-r--r-- | files/zh-cn/conflicting/web/javascript/reference/global_objects/function/index.html | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/javascript/reference/global_objects/function/index.html b/files/zh-cn/conflicting/web/javascript/reference/global_objects/function/index.html new file mode 100644 index 0000000000..b2d20b8cbd --- /dev/null +++ b/files/zh-cn/conflicting/web/javascript/reference/global_objects/function/index.html @@ -0,0 +1,140 @@ +--- +title: Function.prototype +slug: conflicting/Web/JavaScript/Reference/Global_Objects/Function +tags: + - JavaScript + - 函数 + - 原型 + - 原型属性 +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 +--- +<div>{{JSRef}}</div> + +<p><code><strong>Function.prototype</strong></code> 属性存储了 {{jsxref("Function")}} 的原型对象。</p> + +<h2 id="Description" name="Description">描述</h2> + +<p>{{jsxref("Function")}}<code>对象继承自 Function.prototype 属性</code><code>。因此,Function.prototype</code> 不能被修改。</p> + +<h2 id="属性">属性</h2> + +<dl> + <dt>{{jsxref("Function.arguments")}} {{deprecated_inline()}}</dt> + <dd>以数组形式获取传入函数的所有参数。此属性已被{{jsxref("Functions_and_function_scope/arguments", "arguments")}}替代。</dd> + <dt><s class="obsoleteElement">{{jsxref("Function.arity")}} {{obsolete_inline() }}</s></dt> + <dd><s class="obsoleteElement">用于指定的函数的参数的个数,但已被删除。使用{{jsxref("Function.length","length")}}属性代替。</s></dd> + <dt>{{jsxref("Function.caller")}} {{ Non-standard_inline() }}</dt> + <dd>获取调用函数的具体对象。</dd> + <dt>{{jsxref("Function.length")}}</dt> + <dd>获取函数的接收参数个数。</dd> + <dt>{{jsxref("Function.name")}} {{ Non-standard_inline() }}</dt> + <dd>获取函数的名称。</dd> + <dt>{{jsxref("Function.displayName")}} {{ Non-standard_inline() }}</dt> + <dd>获取函数的display name。</dd> + <dt><code>Function.prototype.constructor</code></dt> + <dd>声明函数的原型构造方法,详细请参考 {{jsxref("Object.constructor")}} 。</dd> +</dl> + +<h2 id="方法">方法</h2> + +<dl> + <dt>{{jsxref("Function.prototype.apply()")}}</dt> + <dd>在一个对象的上下文中应用另一个对象的方法;参数能够以数组形式传入。</dd> + <dt>{{jsxref("Function.prototype.bind()")}}</dt> + <dd><span style="font-family: courier new,andale mono,monospace; line-height: 1.5;">bind()</span>方法会创建一个新函数,称为绑定函数.当调用这个绑定函数时,绑定函数会以创建它时传入 <span style="font-family: courier new,andale mono,monospace;">bind()</span>方法的第一个参数作为 <span style="font-family: courier new,andale mono,monospace;">this</span>,传入 <span style="font-family: courier new,andale mono,monospace;">bind()</span>方法的第二个以及以后的参数加上绑定函数运行时本身的参数按照顺序作为原函数的参数来调用原函数.</dd> + <dt>{{jsxref("Function.prototype.call()")}}</dt> + <dd>在一个对象的上下文中应用另一个对象的方法;参数能够以列表形式传入。</dd> + <dt>{{jsxref("Function.prototype.isGenerator()")}} {{ Non-standard_inline() }}</dt> + <dd><code>若函数对象为</code><a href="/zh-CN/docs/Web/JavaScript/Guide/Iterators_and_Generators">generator</a>,返回true,反之返回 <code>false</code>。</dd> + <dt>{{jsxref("Function.prototype.toSource()")}} {{ Non-standard_inline() }}</dt> + <dd>获取函数的实现源码的字符串。 覆盖了 {{jsxref("Object.prototype.toSource")}} 方法。</dd> + <dt>{{jsxref("Function.prototype.toString()")}}</dt> + <dd>获取函数的实现源码的字符串。覆盖了 {{jsxref("Object.prototype.toString")}} 方法。</dd> +</dl> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">说明</th> + </tr> + <tr> + <td>{{SpecName('ES1')}}</td> + <td>{{Spec2('ES1')}}</td> + <td>Initial definition.Implemented in JavaScript 1.1</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.3.5.2', 'Function.prototype')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-function-instances-prototype', 'Function.prototype')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</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="参考">参考</h2> + +<ul> + <li>{{jsxref("Function")}}</li> +</ul> |