aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/functions
diff options
context:
space:
mode:
authort7yang <t7yang@gmail.com>2022-01-10 08:38:07 +0800
committerIrvin <irvinfly@gmail.com>2022-02-16 02:35:54 +0800
commitc40612041809fe289aba58aefa170bbe784aba1f (patch)
tree8ca89b071d04afcf7abd6d9a04d0765a041d9c8a /files/zh-cn/web/javascript/reference/functions
parent12a899ab8540bc84f56a0dc6491be80a48499d49 (diff)
downloadtranslated-content-c40612041809fe289aba58aefa170bbe784aba1f.tar.gz
translated-content-c40612041809fe289aba58aefa170bbe784aba1f.tar.bz2
translated-content-c40612041809fe289aba58aefa170bbe784aba1f.zip
remove name attribute for zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/functions')
-rw-r--r--files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html6
-rw-r--r--files/zh-cn/web/javascript/reference/functions/arguments/index.html12
-rw-r--r--files/zh-cn/web/javascript/reference/functions/arguments/length/index.html8
-rw-r--r--files/zh-cn/web/javascript/reference/functions/arrow_functions/index.html4
-rw-r--r--files/zh-cn/web/javascript/reference/functions/default_parameters/index.html10
-rw-r--r--files/zh-cn/web/javascript/reference/functions/get/index.html6
-rw-r--r--files/zh-cn/web/javascript/reference/functions/index.html6
-rw-r--r--files/zh-cn/web/javascript/reference/functions/rest_parameters/index.html6
-rw-r--r--files/zh-cn/web/javascript/reference/functions/set/index.html6
9 files changed, 32 insertions, 32 deletions
diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html
index a2847f3683..65e9123fe5 100644
--- a/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html
@@ -15,7 +15,7 @@ translation_of: Web/JavaScript/Reference/Functions/arguments/callee
<p><code><strong>arguments.callee </strong></code>属性包含当前正在执行的函数。</p>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p><strong><code>callee</code></strong> 是 <code>arguments</code> 对象的一个属性。它可以用于引用该函数的函数体内当前正在执行的函数。这在函数的名称是未知时很有用,例如在没有名称的函数表达式 (也称为“匿名函数”)内。</p>
@@ -82,9 +82,9 @@ sillyFunction();</pre>
<p>如果 JavaScript 解释器不能保证所有提供的参数数量在被调用的时候都存在,那么它需要在行内代码插入检查,或者不能内联这个函数。现在在这个特殊例子里一个智能的解释器应该能重排检查而更优,并检查任何将不用到的值。然而在许多的情况里那是不可能的,也因此它不能够内联。 </p>
-<h2 id="Example.3A_Using_arguments.callee_in_an_anonymous_recursive_function" name="Example.3A_Using_arguments.callee_in_an_anonymous_recursive_function">例子</h2>
+<h2 id="Example.3A_Using_arguments.callee_in_an_anonymous_recursive_function">例子</h2>
-<h3 id="Example.3A_Using_arguments.callee_in_an_anonymous_recursive_function" name="Example.3A_Using_arguments.callee_in_an_anonymous_recursive_function">在匿名递归函数中使用 <code>arguments.callee</code></h3>
+<h3 id="Example.3A_Using_arguments.callee_in_an_anonymous_recursive_function">在匿名递归函数中使用 <code>arguments.callee</code></h3>
<p>递归函数必须能够引用它本身。很典型的,函数通过自己的名字调用自己。然而,匿名函数 (通过 <a href="/en-US/docs/JavaScript/Reference/Operators/function" title="JavaScript/Reference/Operators/Special/function">函数表达式</a> 或者 <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function" title="JavaScript/Reference/Global_Objects/Function">函数构造器 </a>创建</code>) 没有名称。因此如果没有可访问的变量指向该函数,唯一能引用它的方式就是通过 <code>arguments.callee</code>。</p>
diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/index.html
index b00da02c08..8b708b2c37 100644
--- a/files/zh-cn/web/javascript/reference/functions/arguments/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/arguments/index.html
@@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Functions/arguments
<p>{{EmbedInteractiveExample("pages/js/functions-arguments.html")}}</p>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<div class="blockIndicator note">
<p><strong>Note:</strong> If you're writing ES6 compatible code, then <a href="/zh-CN/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest parameters</a> should be preferred.</p>
@@ -88,7 +88,7 @@ number
<pre class="brush: js">var args = Array.from(arguments);
var args = [...arguments];</pre>
-<h2 id="Properties" name="Properties">属性</h2>
+<h2 id="Properties">属性</h2>
<dl>
<dt><code><a href="/zh-CN/docs/Web/JavaScript/Reference/Functions/arguments/callee" title="JavaScript/Reference/Functions_and_function_scope/arguments/callee">arguments.callee</a></code></dt>
@@ -109,7 +109,7 @@ var args = [...arguments];</pre>
<p>注意: 在严格模式下,<code>arguments</code>对象已与过往不同。<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/@@iterator">arguments[@@iterator]</a></code>不再与函数的实际形参之间共享,同时caller属性也被移除。</p>
</div>
-<h2 id="Examples" name="Examples">例子</h2>
+<h2 id="Examples">例子</h2>
<h3 id="遍历参数求和">遍历参数求和</h3>
@@ -125,7 +125,7 @@ add() // 0
add(1) // 1
add(1,2,3,4); // 10</pre>
-<h3 id="Example_Defining_function_that_concatenates_several_strings" name="Example:_Defining_function_that_concatenates_several_strings">定义连接字符串的函数</h3>
+<h3 id="Example_Defining_function_that_concatenates_several_strings">定义连接字符串的函数</h3>
<p>这个例子定义了一个函数来连接字符串。这个函数唯一正式声明了的参数是一个字符串,该参数指定一个字符作为衔接点来连接字符串。该函数定义如下:</p>
@@ -145,7 +145,7 @@ myConcat("; ", "elephant", "giraffe", "lion", "cheetah");
// returns "sage. basil. oregano. pepper. parsley"
myConcat(". ", "sage", "basil", "oregano", "pepper", "parsley");</pre>
-<h3 id="Example_Defining_a_function_that_creates_HTML_lists" name="Example:_Defining_a_function_that_creates_HTML_lists">定义创建HTML列表的方法</h3>
+<h3 id="Example_Defining_a_function_that_creates_HTML_lists">定义创建HTML列表的方法</h3>
<p>这个例子定义了一个函数通过一个字符串来创建HTML列表。这个函数唯一正式声明了的参数是一个字符。当该参数为 "<code>u</code>" 时,创建一个无序列表 (项目列表);当该参数为 "<code>o</code>" 时,则创建一个有序列表 (编号列表)。该函数定义如下:</p>
@@ -259,7 +259,7 @@ func(); // undefined
<p>{{Compat("javascript.functions.arguments")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Function")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/length/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/length/index.html
index 3bf25335f4..9d0892226a 100644
--- a/files/zh-cn/web/javascript/reference/functions/arguments/length/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/arguments/length/index.html
@@ -11,13 +11,13 @@ translation_of: Web/JavaScript/Reference/Functions/arguments/length
<pre class="syntaxbox">arguments.length</pre>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p>arguments.length表示的是实际上向函数传入了多少个参数,这个数字可以比形参数量大,也可以比形参数量小(形参数量的值可以通过<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/length" title="JavaScript/Reference/Global Objects/Function/length">Function.length</a>获取到).</p>
-<h2 id="Examples" name="Examples">例子</h2>
+<h2 id="Examples">例子</h2>
-<h3 id="Example:_Using_arguments.length" name="Example:_Using_arguments.length">例子: 使用<code>arguments.length</code></h3>
+<h3 id="Example:_Using_arguments.length">例子: 使用<code>arguments.length</code></h3>
<p>这个例中,我们定义了一个可以相加任意个数字的函数.</p>
@@ -68,7 +68,7 @@ translation_of: Web/JavaScript/Reference/Functions/arguments/length
<p>{{Compat("javascript.functions.arguments.length")}}</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/length" title="JavaScript/Reference/Global_Objects/Function/length">Function.length</a></li>
diff --git a/files/zh-cn/web/javascript/reference/functions/arrow_functions/index.html b/files/zh-cn/web/javascript/reference/functions/arrow_functions/index.html
index a3166bf160..ff24c56152 100644
--- a/files/zh-cn/web/javascript/reference/functions/arrow_functions/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/arrow_functions/index.html
@@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Functions/Arrow_functions
{{EmbedInteractiveExample("pages/js/functions-arrow.html")}}
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<blockquote>
<h3 class="brush: js" id="基础语法">基础语法</h3>
@@ -471,7 +471,7 @@ fact(5); // 120</pre>
</tbody>
</table>
-<h2 id="Browser_Compatibility" name="Browser_Compatibility">浏览器兼容</h2>
+<h2 id="Browser_Compatibility">浏览器兼容</h2>
<p>{{Compat("javascript.functions.arrow_functions")}}</p>
diff --git a/files/zh-cn/web/javascript/reference/functions/default_parameters/index.html b/files/zh-cn/web/javascript/reference/functions/default_parameters/index.html
index 86f1722c9e..f280d42cdd 100644
--- a/files/zh-cn/web/javascript/reference/functions/default_parameters/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/default_parameters/index.html
@@ -15,14 +15,14 @@ translation_of: Web/JavaScript/Reference/Functions/Default_parameters
-<h2 id="语法" name="语法">语法</h2>
+<h2 id="语法">语法</h2>
<pre class="syntaxbox">function [<em>name</em>]([<em>param1</em>[ = defaultValue1 ][, ..., <em>paramN</em>[ = defaultValueN ]]]) {
<em> statements</em>
}
</pre>
-<h2 id="描述" name="描述">描述</h2>
+<h2 id="描述">描述</h2>
<p>JavaScript 中函数的参数默认是<code>{{jsxref("undefined")}}</code>。然而,在某些情况下可能需要设置一个不同的默认值。这是默认参数可以帮助的地方。</p>
@@ -58,7 +58,7 @@ multiply(5); // 5</pre>
multiply(5, 2); // 10
multiply(5); // 5</pre>
-<h2 id="示例" name="示例">示例</h2>
+<h2 id="示例">示例</h2>
<h3 id="传入_undefined_vs_其他假值">传入 <code>undefined</code> vs 其他假值</h3>
@@ -205,11 +205,11 @@ f(); // 6</pre>
</tbody>
</table>
-<h2 id="浏览器兼容" name="浏览器兼容">浏览器兼容</h2>
+<h2 id="浏览器兼容">浏览器兼容</h2>
<p>{{Compat("javascript.functions.default_parameters")}}</p>
-<h2 id="相关链接" name="相关链接">相关链接</h2>
+<h2 id="相关链接">相关链接</h2>
<ul>
<li><a class="external external-icon" href="http://wiki.ecmascript.org/doku.php?id=harmony:parameter_default_values" rel="external" title="http://wiki.ecmascript.org/doku.php?id=harmony:parameter_default_values">Original proposal at ecmascript.org</a></li>
diff --git a/files/zh-cn/web/javascript/reference/functions/get/index.html b/files/zh-cn/web/javascript/reference/functions/get/index.html
index 5264abb7a5..613bb86276 100644
--- a/files/zh-cn/web/javascript/reference/functions/get/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/get/index.html
@@ -48,7 +48,7 @@ translation_of: Web/JavaScript/Reference/Functions/get
<h2 id="示例">示例</h2>
-<h3 id="Example_Defining_a_getter_with_the_get_operator" name="Example:_Defining_a_getter_with_the_get_operator">在新对象初始化时定义一个getter</h3>
+<h3 id="Example_Defining_a_getter_with_the_get_operator">在新对象初始化时定义一个getter</h3>
<p>这会为<code>obj</code>创建一个伪属性<code>latest</code>,它会返回<code>log</code>数组的最后一个元素。</p>
@@ -63,7 +63,7 @@ console.log(obj.latest); // "test".</pre>
<p>注意,尝试为<code>latest</code>分配一个值不会改变它。</p>
-<h3 id="Example_Deleting_a_getter_using_the_delete_operator" name="Example:_Deleting_a_getter_using_the_delete_operator">使用<code>delete</code>操作符删除 getter</h3>
+<h3 id="Example_Deleting_a_getter_using_the_delete_operator">使用<code>delete</code>操作符删除 getter</h3>
<p>只需使用 <code><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/delete">delete</a></code>,就可删除 getter:</p>
@@ -161,7 +161,7 @@ console.log(
<p>{{Compat("javascript.functions.get")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">setter</a></li>
diff --git a/files/zh-cn/web/javascript/reference/functions/index.html b/files/zh-cn/web/javascript/reference/functions/index.html
index 6d48ab1c9a..7bf9d86f8e 100644
--- a/files/zh-cn/web/javascript/reference/functions/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/index.html
@@ -59,11 +59,11 @@ translation_of: Web/JavaScript/Reference/Functions
<p>在函数执行时,<a href="/zh-cn/JavaScript/Reference/Operators/this" title="this"><code>this</code> 关键字</a>并不会指向正在运行的函数本身,而是指向调用该函数的对象。所以,如果你想在函数内部获取函数自身的引用,只能使用函数名或者使用<a href="/zh-cn/JavaScript/Reference/Functions_and_function_scope/arguments/callee" title="zh-cn/Core_JavaScript_1.5_Reference/Functions_and_function_scope/arguments/callee">arguments.callee</a>属性(<u><a href="/zh-cn/JavaScript/Strict_mode" title="https://developer.mozilla.org/zh-cn/JavaScript/Strict_mode">严格模式</a></u>下不可用),如果该函数是一个匿名函数,则你只能使用后者。</p>
-<h2 id="Defining_functions" name="Defining_functions">函数定义</h2>
+<h2 id="Defining_functions">函数定义</h2>
<p>定义函数有多种方法:</p>
-<h3 id="The_function_declaration_.28function_statement.29" name="The_function_declaration_.28function_statement.29">函数声明 (函数语句)</h3>
+<h3 id="The_function_declaration_.28function_statement.29">函数声明 (函数语句)</h3>
<p>有一个特殊的语法来声明函数(查看<a href="/zh-cn/JavaScript/Reference/Statements/function" title="zh-cn/Core_JavaScript_1.5_Reference/Statements/function">函数语句</a>了解详情):</p>
@@ -85,7 +85,7 @@ translation_of: Web/JavaScript/Reference/Functions
<dd>组成函数体的声明语句。</dd>
</dl>
-<h3 id="The_function_expression_.28function_operator.29" name="The_function_expression_.28function_operator.29">函数表达式 (<code>function</code> expression)</h3>
+<h3 id="The_function_expression_.28function_operator.29">函数表达式 (<code>function</code> expression)</h3>
<p>函数表达式和函数声明非常相似,它们甚至有相同的语法(查看<a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/function">函数表达式</a>了解详情)。一个函数表达式可能是一个更大的表达式的一部分。可以定义函数“名字”(例如可以在调用堆栈时使用)或者使用“匿名”函数。函数表达式不会提升,所以不能在定义之前调用。</p>
diff --git a/files/zh-cn/web/javascript/reference/functions/rest_parameters/index.html b/files/zh-cn/web/javascript/reference/functions/rest_parameters/index.html
index 406552c11c..cf59dc41c9 100644
--- a/files/zh-cn/web/javascript/reference/functions/rest_parameters/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/rest_parameters/index.html
@@ -77,7 +77,7 @@ f(1) // NaN (b and c are undefined)
f(1, 2, 3) // 6
f(1, 2, 3, 4) // 6 (the fourth parameter is not destructured)</pre>
-<h2 id="Example" name="Example">示例</h2>
+<h2 id="Example">示例</h2>
<p>因为<code>theArgs</code>是个数组,所以你可以使用<code>length</code>属性得到剩余参数的个数:</p>
@@ -127,7 +127,7 @@ alert(sortArguments(5,3,7,1)); // 抛出TypeError异常:arguments.sort is not a
}
console.log(sortArguments(5, 3, 7, 1)); // shows 1, 3, 5, 7</pre>
-<h2 id="Specifications" name="Specifications">规范</h2>
+<h2 id="Specifications">规范</h2>
<table class="standard-table">
<tbody>
@@ -153,7 +153,7 @@ console.log(sortArguments(5, 3, 7, 1)); // shows 1, 3, 5, 7</pre>
<p>{{Compat("javascript.functions.rest_parameters")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator" title="spread operator">Spread operator</a> (also ‘<code>...</code>’)</li>
diff --git a/files/zh-cn/web/javascript/reference/functions/set/index.html b/files/zh-cn/web/javascript/reference/functions/set/index.html
index ce864843d1..76f67c2779 100644
--- a/files/zh-cn/web/javascript/reference/functions/set/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/set/index.html
@@ -51,7 +51,7 @@ translation_of: Web/JavaScript/Reference/Functions/set
<h2 id="示例">示例</h2>
-<h3 id="Example_Defining_a_getter_with_the_get_operator" name="Example:_Defining_a_getter_with_the_get_operator">在对象初始化时定义 setter</h3>
+<h3 id="Example_Defining_a_getter_with_the_get_operator">在对象初始化时定义 setter</h3>
<p>这将定义一个对象 <code>language</code> 的伪属性<code>current</code>,当<code>current</code>被分配一个值时,将使用该值更新<code>log</code>:</p>
@@ -70,7 +70,7 @@ console.log(language.log); // ['EN', 'FA']</pre>
<p>请注意,<code>current</code>属性是未定义的,访问它时将会返回 <code>undefined</code>。</p>
-<h3 id="Example_Removing_a_setter_with_the_delete_operator" name="Example:_Removing_a_setter_with_the_delete_operator">用 <code>delete</code> 操作符移除一个 setter</h3>
+<h3 id="Example_Removing_a_setter_with_the_delete_operator">用 <code>delete</code> 操作符移除一个 setter</h3>
<p>我们可以使用<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete">delete</a></code>操作符移除 setter。</p>
@@ -121,7 +121,7 @@ console.log(obj.baz); // "baz"
<p>{{Compat("javascript.functions.set")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li><a href="/zh-CN/docs/Web/JavaScript/Reference/Functions/get">getter</a></li>