aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/function
diff options
context:
space:
mode:
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.html14
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/call/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/caller/index.html10
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/length/index.html4
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html10
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html6
6 files changed, 23 insertions, 23 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 89706614c4..67a69174e6 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
@@ -17,11 +17,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre class="syntaxbox"><code><em>func</em>.apply(<em>thisArg</em><em>, [</em><em>argsArray</em>])</code></pre>
-<h3 id="Parameters" name="Parameters">参数</h3>
+<h3 id="Parameters">参数</h3>
<dl>
<dt><code>thisArg</code></dt>
@@ -34,7 +34,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply
<p>调用有指定<code><strong>this</strong></code>值和参数的函数的结果。</p>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p>在调用一个存在的函数时,你可以为其指定一个 <code>this</code> 对象。 <code>this</code> 指当前对象,也就是正在调用这个函数的对象。 使用 <code>apply</code>, 你可以只写一次这个方法然后在另一个对象中继承它,而不用在新对象中重复写该方法。</p>
@@ -48,7 +48,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply
<p>需要注意:Chrome 14 以及 Internet Explorer 9 仍然不接受类数组对象。如果传入类数组对象,它们会抛出异常。</p>
</div>
-<h2 id="Examples" name="Examples">示例</h2>
+<h2 id="Examples">示例</h2>
<h3 id="用_apply_将数组各项添加到另一个数组">用 <code>apply</code> 将数组各项添加到另一个数组</h3>
@@ -64,7 +64,7 @@ array.push.apply(array, elements);
console.info(array); // ["a", "b", 0, 1, 2]
</pre>
-<h3 id="apply_and_built-in_functions" name="apply_and_built-in_functions">使用<code>apply</code>和内置函数</h3>
+<h3 id="apply_and_built-in_functions">使用<code>apply</code>和内置函数</h3>
<p>对于一些需要写循环以遍历数组各项的需求,我们可以用<code>apply</code>完成以避免循环。</p>
@@ -106,7 +106,7 @@ for (var i = 0; i &lt; numbers.length; i++) {
var min = minOfArray([5, 6, 2, 3, 7]);
</pre>
-<h3 id="Using_apply_to_chain_constructors" name="Using_apply_to_chain_constructors">使用apply来链接构造器</h3>
+<h3 id="Using_apply_to_chain_constructors">使用apply来链接构造器</h3>
<p>你可以使用apply来链接一个对象<a href="/zh-CN/docs/JavaScript/Reference/Operators/new" title="JavaScript/Reference/Operators/new">构造器</a>,类似于Java。在接下来的例子中我们会创建一个全局<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function" title="JavaScript/Reference/Global_Objects/Function"><code>Function</code></a> 对象的construct方法 ,来使你能够在构造器中使用一个类数组对象而非参数列表。</p>
@@ -204,7 +204,7 @@ console.log(myInstance.constructor);              // logs "MyConstructor"
<p>{{Compat("javascript.builtins.Function.apply")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Functions_and_function_scope/arguments", "arguments ")}} object</li>
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 5962c181a0..9474d40416 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
@@ -165,7 +165,7 @@ display.call(); // Cannot read the property of 'sData' of undefined</pre>
<p>{{Compat("javascript.builtins.Function.call")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Function.prototype.bind()")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/caller/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/caller/index.html
index ba3ce01a26..c3394dee07 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/caller/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/caller/index.html
@@ -5,19 +5,19 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/caller
---
<div>{{JSRef("Global_Objects", "Function")}} {{non-standard_header}}</div>
-<h2 id="Summary" name="Summary">概述</h2>
+<h2 id="Summary">概述</h2>
<p>返回调用指定函数的函数.</p>
<p>该属性不是ECMA-262第3版标准的一部分.不过, <a href="/zh-cn/SpiderMonkey" title="zh-cn/SpiderMonkey">SpiderMonkey</a> (Mozilla的JavaScript引擎) (查看{{ Bug("65683") }}), V8 (Chrome的JavaScript引擎) 和 JScript(IE的ECMAScript实现)都已经支持了它.</p>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p>如果一个函数<code>f</code>是在全局作用域内被调用的,则<code>f.caller为</code><code>null</code>,相反,如果一个函数是在另外一个函数作用域内被调用的,则<code>f.caller指向调用它的那个函数.</code></p>
<p>该属性的常用形式<code>arguments.callee.caller</code>替代了被废弃的 <a href="/zh-cn/JavaScript/Reference/Functions_and_function_scope/arguments/caller" title="zh-cn/JavaScript/Reference/Functions_and_function_scope/arguments/caller">arguments.caller</a>.</p>
-<h3 id="Notes" name="Notes">备注</h3>
+<h3 id="Notes">备注</h3>
<p>注意,在使用递归调用时, 你不能使用此属性来重现出调用栈.请考虑以下代码:</p>
@@ -50,9 +50,9 @@ while (f) {
<p>有一个特殊属性 <code>__caller__</code>, 可以返回调用当前函数的函数的活动对象(可以用来重现出整个调用栈), 但由于安全原因的考虑,该属性已被删除.</p>
-<h2 id="Examples" name="Examples">例子</h2>
+<h2 id="Examples">例子</h2>
-<h3 id="Example:_Checking_the_value_of_a_function.27s_caller_property" name="Example:_Checking_the_value_of_a_function.27s_caller_property">例子: 检测一个函数的<code>caller</code>属性的值</h3>
+<h3 id="Example:_Checking_the_value_of_a_function.27s_caller_property">例子: 检测一个函数的<code>caller</code>属性的值</h3>
<p>下例用来得出一个函数是被谁调用的<code>.</code></p>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/length/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/length/index.html
index 42532bd8ad..699cce5844 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/length/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/length/index.html
@@ -15,7 +15,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/length
<div>{{js_property_attributes(0,0,1)}}</div>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p><code>length</code> 是函数对象的一个属性值,指该函数期望传入的参数数量,即形参的个数。</p>
@@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/length
<p> {{jsxref("Function.prototype")}}  对象的 length 属性值为 0 。</p>
-<h2 id="Examples" name="Examples">示例</h2>
+<h2 id="Examples">示例</h2>
<pre class="brush: js">console.log(Function.length); /* 1 */
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html
index 5c4de38138..851e354fc7 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/tosource/index.html
@@ -7,21 +7,21 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/toSource
<div>{{JSRef("Global_Objects", "Function")}} {{non-standard_header}}</div>
</div>
-<h2 id="Summary" name="Summary">概述</h2>
+<h2 id="Summary">概述</h2>
<p>返回函数的源代码的字符串表示.</p>
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre class="syntaxbox"><code><var>function</var>.toSource();
Function.toSource();
</code></pre>
-<h3 id="Parameters" name="Parameters">参数</h3>
+<h3 id="Parameters">参数</h3>
<p>无</p>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p><code>toSource方法返回下面的值</code>:</p>
@@ -41,7 +41,7 @@ Function.toSource();
<p>该方法通常在引擎内部调用.你可以在调试的时候用该方法开查看一个函数的源代码.</p>
-<h2 id="See_Also" name="See_Also">相关链接</h2>
+<h2 id="See_Also">相关链接</h2>
<ul>
<li><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/toString" title="JavaScript/Reference/Global_Objects/Function/toString">toString</a></li>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html
index 1ab33a0d1f..4095dfba6a 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html
@@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/toString
<div>{{EmbedInteractiveExample("pages/js/function-tostring.html")}}</div>
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre class="syntaxbox"><code><var>function</var>.toString()</code></pre>
@@ -21,7 +21,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/toString
<p>表示函数源代码的一个字符串</p>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p>{{jsxref("Function")}}对象覆盖了从{{jsxref("Object")}}继承来的{{jsxref("Object.prototype.toString", "toString")}} 方法。对于用户定义的 {{jsxref("Function")}} 对象,<code>toString</code>方法返回一个字符串,其中包含用于定义函数的源文本段。</p>
@@ -223,7 +223,7 @@ Function("a", "b")</pre>
<li>从Firefox 38开始,<code>Function.prototype.toString()</code> 会对 {{jsxref("Proxy")}} 对象抛出异常 ({{bug(1100936)}})。</li>
</ul>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Object.prototype.toString()")}}</li>