aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/function
diff options
context:
space:
mode:
authorIrvin <irvinfly@gmail.com>2022-02-16 02:14:18 +0800
committerIrvin <irvinfly@gmail.com>2022-02-16 02:35:54 +0800
commitd44f5032d0f53256b2d5aef505d6b593fd3cd158 (patch)
tree4b585f4be9c9a2712664ad10e7acf62c83fff51f /files/zh-cn/web/javascript/reference/global_objects/function
parentf45e9e070c93ebbd83d488bdd775987a4d75c201 (diff)
downloadtranslated-content-d44f5032d0f53256b2d5aef505d6b593fd3cd158.tar.gz
translated-content-d44f5032d0f53256b2d5aef505d6b593fd3cd158.tar.bz2
translated-content-d44f5032d0f53256b2d5aef505d6b593fd3cd158.zip
fix yari h2m dry run errors (zh-CN)
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/function')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html12
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/arguments/index.html52
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/call/index.html6
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/displayname/index.html56
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/name/index.html6
6 files changed, 20 insertions, 114 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html
index 67a69174e6..bee3572f70 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html
@@ -11,7 +11,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply
<p><strong><code>apply()</code></strong> 方法调用一个具有给定<code>this</code>值的函数,以及以一个数组(或<a href="/zh-CN/docs/Web/JavaScript/Guide/Indexed_collections#Working_with_array-like_objects">类数组对象</a>)的形式提供的参数。</p>
-<div class="note"><strong>注意:</strong>call()方法的作用和 apply() 方法类似,区别就是<code>call()</code>方法接受的是<strong>参数列表</strong>,而<code>apply()</code>方法接受的是<strong>一个参数数组</strong>。</div>
+<div class="note">
+<p><strong>备注:</strong>call()方法的作用和 apply() 方法类似,区别就是<code>call()</code>方法接受的是<strong>参数列表</strong>,而<code>apply()</code>方法接受的是<strong>一个参数数组</strong>。</p>
+</div>
<div>{{EmbedInteractiveExample("pages/js/function-apply.html")}}</div>
@@ -45,7 +47,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply
<p>从 ECMAScript 第5版开始,可以使用任何种类的类数组对象,就是说只要有一个 <code>length</code> 属性和<code>(0..length-1)</code>范围的整数属性。例如现在可以使用 {{domxref("NodeList")}} 或一个自己定义的类似 <code>{'length': 2, '0': 'eat', '1': 'bananas'}</code> 形式的对象。</p>
<div class="note">
-<p>需要注意:Chrome 14 以及 Internet Explorer 9 仍然不接受类数组对象。如果传入类数组对象,它们会抛出异常。</p>
+<p><strong>备注:</strong> Chrome 14 以及 Internet Explorer 9 仍然不接受类数组对象。如果传入类数组对象,它们会抛出异常。</p>
</div>
<h2 id="Examples">示例</h2>
@@ -118,7 +120,7 @@ var min = minOfArray([5, 6, 2, 3, 7]);
</pre>
<div class="note">
-<p><strong>注意:</strong> 上面使用的<code>Object.create()</code>方法相对来说比较新。另一种可选的方法,请考虑如下替代方法:</p>
+<p><strong>备注:</strong> 上面使用的<code>Object.create()</code>方法相对来说比较新。另一种可选的方法,请考虑如下替代方法:</p>
<p>Using {{jsxref("Object/__proto__", "Object.__proto__")}}:</p>
@@ -166,7 +168,9 @@ console.log(myInstance instanceof MyConstructor); // logs "true"
console.log(myInstance.constructor);              // logs "MyConstructor"
</pre>
-<div class="note"><strong>注意:</strong> 这个非native的<code>Function.construct</code>方法无法和一些native构造器(例如<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Date" title="JavaScript/Reference/Global_Objects/Date"><code>Date</code></a>)一起使用。 在这种情况下你必须使用<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors" title="JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors"><code>Function.bind</code></a>方法(例如,想象有如下一个数组要用在Date构造器中: <code>[2012, 11, 4]</code>;这时你需要这样写: <code>new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()</code> – -无论如何这不是最好的实现方式并且也许不该用在任何生产环境中).</div>
+<div class="note">
+<p><strong>备注:</strong> 这个非native的<code>Function.construct</code>方法无法和一些native构造器(例如<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Date" title="JavaScript/Reference/Global_Objects/Date"><code>Date</code></a>)一起使用。 在这种情况下你必须使用<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors" title="JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors"><code>Function.bind</code></a>方法(例如,想象有如下一个数组要用在Date构造器中: <code>[2012, 11, 4]</code>;这时你需要这样写: <code>new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()</code> – -无论如何这不是最好的实现方式并且也许不该用在任何生产环境中).</p>
+</div>
<h2 id="规范">规范</h2>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/arguments/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/arguments/index.html
index ef832c70db..f7ab79e806 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/arguments/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/arguments/index.html
@@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/arguments
---
<div>{{JSRef}} {{deprecated_header}}</div>
-<p><code><strong><em>function</em>.arguments</strong></code> 属性代表传入函数的实参,它是一个类数组对象。</p>
+<p><code>function.arguments</code> 属性代表传入函数的实参,它是一个类数组对象。</p>
<h2 id="描述">描述</h2>
@@ -67,55 +67,7 @@ console.log('函数退出后的 arguments 属性值:' + g.arguments);
<h2 id="浏览器兼容性">浏览器兼容性</h2>
-<div>{{CompatibilityTable}}</div>
-
-<div>
-<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>
-<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>
+{{Compat}}
<h2 id="相关链接">相关链接</h2>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html
index 45ee18de46..cb2c83b2a7 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html
@@ -140,7 +140,7 @@ flower.bloom(); // 一秒钟后, 调用 'declare' 方法</code></pre>
<h3 id="作为构造函数使用的绑定函数">作为构造函数使用的绑定函数</h3>
<div class="warning">
-<p><strong>警告</strong> :这部分演示了 JavaScript 的能力并且记录了 <code>bind()</code> 的超前用法。以下展示的方法并不是最佳的解决方案,且可能不应该用在任何生产环境中。</p>
+<p><strong>警告:</strong>这部分演示了 JavaScript 的能力并且记录了 <code>bind()</code> 的超前用法。以下展示的方法并不是最佳的解决方案,且可能不应该用在任何生产环境中。</p>
</div>
<p>绑定函数自动适应于使用 {{jsxref("Operators/new", "new")}} 操作符去构造一个由目标函数创建的新实例。当一个绑定函数是用来构建一个值的,原来提供的 <code>this</code> 就会被忽略。不过提供的参数列表仍然会插入到构造函数调用时的参数列表之前。</p>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html
index 9474d40416..a4bce37d0f 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html
@@ -11,7 +11,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/call
<p><code><strong>call()</strong></code> 方法使用一个指定的 <code>this</code> 值和单独给出的一个或多个参数来调用一个函数。</p>
-<div class="note"><strong>注意:</strong>该方法的语法和作用与 {{jsxref("Function.apply", "apply()")}} 方法类似,只有一个区别,就是 <code>call()</code> 方法接受的是<strong>一个参数列表</strong>,而 <code>apply()</code> 方法接受的是<strong>一个包含多个参数的数组</strong>。</div>
+<div class="note">
+<p><strong>备注:</strong>该方法的语法和作用与 {{jsxref("Function.apply", "apply()")}} 方法类似,只有一个区别,就是 <code>call()</code> 方法接受的是<strong>一个参数列表</strong>,而 <code>apply()</code> 方法接受的是<strong>一个包含多个参数的数组</strong>。</p>
+</div>
<div>{{EmbedInteractiveExample("pages/js/function-call.html")}}</div>
@@ -114,7 +116,7 @@ function display() {
display.call(); // sData value is Wisen</pre>
<div class="note">
-<p><strong>注意:</strong>在严格模式下,<code>this</code> 的值将会是 <code>undefined</code>。见下文。</p>
+<p><strong>备注:</strong>在严格模式下,<code>this</code> 的值将会是 <code>undefined</code>。见下文。</p>
</div>
<pre class="brush: js">'use strict';
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/displayname/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/displayname/index.html
index c07f677636..4fab613040 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/displayname/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/displayname/index.html
@@ -66,56 +66,6 @@ a; // "function My Function()"</pre>
<p>不属于任何规范</p>
-<h2 id="Browser_compatibility_浏览器兼容性">Browser compatibility 浏览器兼容性</h2>
-
-<p>如果你愿意贡献数据,请访问<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>并同时给我们发送推送请求。</p>
-
-<div>{{CompatibilityTable}}</div>
-
-<div>
-<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>{{CompatUnknown}}</td>
- <td>{{CompatGeckoDesktop(13)}}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- </tr>
- </tbody>
-</table>
-</div>
-
-<div>
-<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>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- </tr>
- </tbody>
-</table>
-</div>
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+{{Compat}}
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html
index 0f7695c49e..7d0557c5a4 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html
@@ -10,12 +10,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/name
---
<div>{{JSRef("Global_Objects", "Function")}}</div>
-<div><code><strong><em>function</em>.name</strong></code> 属性返回函数实例的名称。</div>
+<div><code>function.name</code> 属性返回函数实例的名称。</div>
<p>{{js_property_attributes(0,0,1)}}</p>
<div class="note">
-<p>请注意,在非标准的ES2015之前的实现中,<code>configurable</code>属性也是<code>false</code> 。</p>
+<p><strong>备注:</strong>在非标准的ES2015之前的实现中,<code>configurable</code>属性也是<code>false</code> 。</p>
</div>
<h2 id="示例">示例</h2>
@@ -184,7 +184,6 @@ if (b.constructor.name === 'Foo') {
<p>在未压缩版本中,程序运行到真实分支并打印<code>'foo' is an instance of 'Foo'</code>。 而在压缩版本中,它的行为不同,并且进入else分支。如果您依赖于<code>Function.name</code>,就像上面的示例一样,确保您的构建管道不会更改函数名称,也不要假定函数具有特定的名称。</p>
-<article>
<h2 id="规范">规范</h2>
<table class="standard-table">
@@ -210,4 +209,3 @@ if (b.constructor.name === 'Foo') {
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("javascript.builtins.Function.name")}}</p>
-</article>