aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/statements
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/statements
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/statements')
-rw-r--r--files/zh-cn/web/javascript/reference/statements/block/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/statements/break/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/statements/continue/index.html8
-rw-r--r--files/zh-cn/web/javascript/reference/statements/debugger/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/statements/do...while/index.html8
-rw-r--r--files/zh-cn/web/javascript/reference/statements/empty/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/statements/for...in/index.html6
-rw-r--r--files/zh-cn/web/javascript/reference/statements/function/index.html8
-rw-r--r--files/zh-cn/web/javascript/reference/statements/if...else/index.html12
-rw-r--r--files/zh-cn/web/javascript/reference/statements/label/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/statements/return/index.html8
-rw-r--r--files/zh-cn/web/javascript/reference/statements/var/index.html4
-rw-r--r--files/zh-cn/web/javascript/reference/statements/with/index.html10
13 files changed, 37 insertions, 37 deletions
diff --git a/files/zh-cn/web/javascript/reference/statements/block/index.html b/files/zh-cn/web/javascript/reference/statements/block/index.html
index e7aac1d011..554d185e8e 100644
--- a/files/zh-cn/web/javascript/reference/statements/block/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/block/index.html
@@ -152,7 +152,7 @@ a[6](); // 6</pre>
<p>{{Compat("javascript.statements.block")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Statements/while", "while")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/statements/break/index.html b/files/zh-cn/web/javascript/reference/statements/break/index.html
index a15c0bf7d9..cce30700ab 100644
--- a/files/zh-cn/web/javascript/reference/statements/break/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/break/index.html
@@ -164,7 +164,7 @@ testBreak(1); // SyntaxError: Illegal break statement
<p>{{Compat("javascript.statements.break")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Statements/continue", "continue")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/statements/continue/index.html b/files/zh-cn/web/javascript/reference/statements/continue/index.html
index 8d58c28a2b..3d8d98de7d 100644
--- a/files/zh-cn/web/javascript/reference/statements/continue/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/continue/index.html
@@ -23,7 +23,7 @@ translation_of: Web/JavaScript/Reference/Statements/continue
<dd>标识标号关联的语句</dd>
</dl>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p>与 {{jsxref("Statements/break", "break")}} 语句的区别在于, continue 并不会终止循环的迭代,而是:</p>
@@ -37,9 +37,9 @@ translation_of: Web/JavaScript/Reference/Statements/continue
<p><code>continue</code> 语句可以包含一个可选的标号以控制程序跳转到指定循环的下一次迭代,而非当前循环。此时要求 <code>continue</code> 语句在对应的循环内部。</p>
-<h2 id="Examples" name="Examples">示例</h2>
+<h2 id="Examples">示例</h2>
-<h3 id="Example_Using_continue_with_while" name="Example:_Using_continue_with_while">在 <code>while</code> 语句中使用 <code>continue</code></h3>
+<h3 id="Example_Using_continue_with_while">在 <code>while</code> 语句中使用 <code>continue</code></h3>
<p>下述例子展示了一个在<code>i</code> 为 3时执行<code>continue</code> 语句的 {{jsxref("Statements/while", "while")}} 循环。因此,<code>n</code> 的值在几次迭代后分别为 1, 3, 7 和 12 .</p>
@@ -148,7 +148,7 @@ checkiandj: while (i &lt; 4) {
<p>{{Compat("javascript.statements.continue")}}</p>
-<h2 id="See_also" name="See_also">See also</h2>
+<h2 id="See_also">See also</h2>
<ul>
<li>{{jsxref("Statements/break", "break")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/statements/debugger/index.html b/files/zh-cn/web/javascript/reference/statements/debugger/index.html
index 0f07a5b799..d87e77bfb8 100644
--- a/files/zh-cn/web/javascript/reference/statements/debugger/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/debugger/index.html
@@ -69,7 +69,7 @@ translation_of: Web/JavaScript/Reference/Statements/debugger
<p>{{Compat("javascript.statements.debugger")}}</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/Debugging_JavaScript">JavaScript调试</a></li>
diff --git a/files/zh-cn/web/javascript/reference/statements/do...while/index.html b/files/zh-cn/web/javascript/reference/statements/do...while/index.html
index 614ef2ad4b..45eaec2221 100644
--- a/files/zh-cn/web/javascript/reference/statements/do...while/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/do...while/index.html
@@ -12,7 +12,7 @@ translation_of: Web/JavaScript/Reference/Statements/do...while
<p><strong><code>do...while</code> 语句</strong>创建一个执行指定语句的循环,直到<code>condition</code>值为 false。在执行<code>statement</code> 后检测<code>condition</code>,所以指定的<code>statement</code>至少执行一次。</p>
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre class="syntaxbox">do
<em>statement</em>
@@ -29,9 +29,9 @@ while (<em>condition</em>);
<dd>循环中每次都会计算的表达式。如果 <code>condition</code> 值为真, <code>statement</code> 会再次执行。当 <code>condition</code> 值为假,则跳到<code>do...while</code>之后的语句。</dd>
</dl>
-<h2 id="Examples" name="Examples">示例</h2>
+<h2 id="Examples">示例</h2>
-<h3 id="Example:_Using_do...while" name="Example:_Using_do...while">使用 <code>do...while</code></h3>
+<h3 id="Example:_Using_do...while">使用 <code>do...while</code></h3>
<p>下面的例子中,<code>do...while</code> 循环至少迭代一次,并且继续迭代直到 <code>i</code>不再小于 5 时结束。</p>
@@ -91,7 +91,7 @@ document.getElementById('example').innerHTML = result;</pre>
<p>{{Compat("javascript.statements.do_while")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Statements/while", "while")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/statements/empty/index.html b/files/zh-cn/web/javascript/reference/statements/empty/index.html
index d81f59a0dc..f6809c7229 100644
--- a/files/zh-cn/web/javascript/reference/statements/empty/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/empty/index.html
@@ -96,7 +96,7 @@ else
<p>{{Compat("javascript.statements.empty")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Statements/block", "块语句")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/statements/for...in/index.html b/files/zh-cn/web/javascript/reference/statements/for...in/index.html
index 4bb666e930..2f9dba87ce 100644
--- a/files/zh-cn/web/javascript/reference/statements/for...in/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/for...in/index.html
@@ -10,7 +10,7 @@ translation_of: Web/JavaScript/Reference/Statements/for...in
<p><strong><code>for...in</code>语句</strong>以任意顺序遍历一个对象的除<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol">Symbol</a>以外的<a href="/zh-CN/docs/Web/JavaScript/Enumerability_and_ownership_of_properties">可枚举</a>属性,包括继承的可枚举属性。</p>
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre>for (<var>variable</var> in <var>object</var>)
statement</pre>
@@ -37,13 +37,13 @@ translation_of: Web/JavaScript/Reference/Statements/for...in
<p>如果你只要考虑对象本身的属性,而不是它的原型,那么使用 {{jsxref("Object.getOwnPropertyNames", "getOwnPropertyNames()")}} 或执行 {{jsxref("Object.prototype.hasOwnProperty", "hasOwnProperty()")}} 来确定某属性是否是对象本身的属性(也能使用{{jsxref("Object.prototype.propertyIsEnumerable", "propertyIsEnumerable")}})。或者,如果你知道不会有任何外部代码干扰,您可以使用检查方法扩展内置原型。</p>
-<h2 id="Example" name="Example">为什么用for ... in?</h2>
+<h2 id="Example">为什么用for ... in?</h2>
<p><code>for ... in</code>是为遍历对象属性而构建的,不建议与数组一起使用,数组可以用<code>Array.prototype.forEach()</code>和<code>for ... of</code>,那么<code>for ... in</code>的到底有什么用呢?</p>
<p>它最常用的地方应该是用于调试,可以更方便的去检查对象属性(通过输出到控制台或其他方式)。尽管对于处理存储数据,数组更实用些,但是你在处理有<code>key-value</code>数据(比如属性用作“键”),需要检查其中的任何键是否为某值的情况时,还是推荐用<code>for ... in</code>。</p>
-<h2 id="Example" name="Example">示例</h2>
+<h2 id="Example">示例</h2>
<p>下面的函数接受一个对象作为参数。被调用时迭代传入对象的所有可枚举属性然后返回一个所有属性名和其对应值的字符串。</p>
diff --git a/files/zh-cn/web/javascript/reference/statements/function/index.html b/files/zh-cn/web/javascript/reference/statements/function/index.html
index ef61d65141..e094148986 100644
--- a/files/zh-cn/web/javascript/reference/statements/function/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/function/index.html
@@ -39,7 +39,7 @@ translation_of: Web/JavaScript/Reference/Statements/function
<dd>包含函数体的语句。</dd>
</dl>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p>一个被函数声明创建的函数是一个 Function 对象,具有 Function 对象的所有属性、方法和行为。查看 <a href="/en/JavaScript/Reference/Global_Objects/Function">Function</a> 以获取 function 的详细信息。</p>
@@ -114,9 +114,9 @@ var notHoisted = function() {
};
</pre>
-<h2 id="Examples" name="Examples">示例</h2>
+<h2 id="Examples">示例</h2>
-<h3 id="Example_Using_function" name="Example:_Using_function">使用函数</h3>
+<h3 id="Example_Using_function">使用函数</h3>
<p>下面的代码声明了一个函数,该函数返回了销售的总金额, 参数是产品a,b,c分别的销售的数量.</p>
@@ -157,7 +157,7 @@ var notHoisted = function() {
<p>{{Compat("javascript.statements.function")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Functions_and_function_scope", "Functions and function scope")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/statements/if...else/index.html b/files/zh-cn/web/javascript/reference/statements/if...else/index.html
index 3c64ce0538..3d5ebf6e8f 100644
--- a/files/zh-cn/web/javascript/reference/statements/if...else/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/if...else/index.html
@@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Statements/if...else
<p>{{EmbedInteractiveExample("pages/js/statement-ifelse.html")}}</p>
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre class="syntaxbox">if (<em>condition</em>)
<em>statement1</em>
@@ -37,7 +37,7 @@ translation_of: Web/JavaScript/Reference/Statements/if...else
<dd>如果<code>condition</code>为假且 <code>else</code>从句存在时执行的语句。可为任意语句,包括块语句和嵌套的<code>if</code>语句。</dd>
</dl>
-<h2 id="Description" name="Description">说明</h2>
+<h2 id="Description">说明</h2>
<p>多层 <code>if...else</code> 语句可使用 <code>else if</code> 从句。注意:在 Javascript 中没有 <code>elseif</code> (一个单词)关键字。</p>
@@ -80,9 +80,9 @@ else
if (b) //表达式的值为true
</pre>
-<h2 id="Examples" name="Examples">示例</h2>
+<h2 id="Examples">示例</h2>
-<h3 id="Example:_Using_if...else" name="Example:_Using_if...else">使用 <code>if...else</code></h3>
+<h3 id="Example:_Using_if...else">使用 <code>if...else</code></h3>
<pre class="brush: js">if (cipher_char === from_char) {
result = result + to_char;
@@ -104,7 +104,7 @@ if (b) //表达式的值为true
/* do the right thing */
}</pre>
-<h3 id="Example:_Assignment_within_the_conditional_expression" name="Example:_Assignment_within_the_conditional_expression">条件表达式中的赋值运算</h3>
+<h3 id="Example:_Assignment_within_the_conditional_expression">条件表达式中的赋值运算</h3>
<p>建议不要在条件表达式中单纯的使用赋值运算,因为粗看下赋值运算的代码很容易让人误认为是等性比较。比如,不要使用下面示例的代码:</p>
@@ -161,7 +161,7 @@ if (b) //表达式的值为true
<p>{{Compat("javascript.statements.if_else")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Statements/block", "block")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/statements/label/index.html b/files/zh-cn/web/javascript/reference/statements/label/index.html
index c0bf3413c7..e05f426275 100644
--- a/files/zh-cn/web/javascript/reference/statements/label/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/label/index.html
@@ -108,7 +108,7 @@ for (i = 0; i &lt; 3; i++) { //The first for statement is labeled "loop1"
// "i = 1, j = 0"
// Notice the difference with the previous continue example</pre>
-<h3 id="Example_3" name="Example_3">使用带标记的 <code>break</code> 语句</h3>
+<h3 id="Example_3">使用带标记的 <code>break</code> 语句</h3>
<p>若给定一个数据数组和一个测试数组,则下面的例子会判断是否所有数据均通过了测试。</p>
diff --git a/files/zh-cn/web/javascript/reference/statements/return/index.html b/files/zh-cn/web/javascript/reference/statements/return/index.html
index 8c82917d96..473f330f50 100644
--- a/files/zh-cn/web/javascript/reference/statements/return/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/return/index.html
@@ -12,7 +12,7 @@ translation_of: Web/JavaScript/Reference/Statements/return
<p><strong><code>return</code>语句</strong>终止函数的执行,并返回一个指定的值给函数调用者。</p>
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre class="syntaxbox">return [[expression]]; </pre>
@@ -60,9 +60,9 @@ a + b;</pre>
<p>从 Gecko 40 {{geckoRelease(40)}}开始,如果在一个 return 语句后发现无法访问的代码,控制台将会显示一个警告。</p>
</div>
-<h2 id="Examples" name="Examples">示例</h2>
+<h2 id="Examples">示例</h2>
-<h3 id="Example:_Using_return" name="Example:_Using_return">中断一个函数的执行</h3>
+<h3 id="Example:_Using_return">中断一个函数的执行</h3>
<p>函数将会在<code>return</code>语句执行后立即中止。</p>
@@ -139,7 +139,7 @@ answer(1337); // 56154
<p>{{Compat("javascript.statements.return")}}</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_and_function_scope" title="En/Core_JavaScript_1.5_Reference/Functions">函数和函数作用域</a></li>
diff --git a/files/zh-cn/web/javascript/reference/statements/var/index.html b/files/zh-cn/web/javascript/reference/statements/var/index.html
index 4f5736c4ee..95c4d22d88 100644
--- a/files/zh-cn/web/javascript/reference/statements/var/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/var/index.html
@@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Statements/var
<dd>变量的初始化值。该值可以是任何合法的表达式。默认值为 <code>undefined</code>。</dd>
</dl>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p>变量声明,无论发生在何处,都在执行任何代码之前进行处理。用 <code>var</code> 声明的变量的作用域是它当前的执行上下文,它可以是嵌套的函数,或者对于声明在任何函数外的变量来说是全局。如果你重新声明一个 JavaScript 变量,它将不会丢失其值。</p>
@@ -105,7 +105,7 @@ function do_something() {
console.log(bar); // 111
}</pre>
-<h2 id="Examples" name="Examples">例子</h2>
+<h2 id="Examples">例子</h2>
<h3 id="声明并初始化两个变量:">声明并初始化两个变量:</h3>
diff --git a/files/zh-cn/web/javascript/reference/statements/with/index.html b/files/zh-cn/web/javascript/reference/statements/with/index.html
index 4454271872..cca0407da3 100644
--- a/files/zh-cn/web/javascript/reference/statements/with/index.html
+++ b/files/zh-cn/web/javascript/reference/statements/with/index.html
@@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Statements/with
<div><strong>with语句 </strong>扩展一个语句的作用域链。</div>
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre class="syntaxbox">with (expression) {
<em>statement</em>
@@ -27,7 +27,7 @@ translation_of: Web/JavaScript/Reference/Statements/with
<dd>任何语句。要执行多个语句,请使用一个<a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/block">块</a>语句 ({ ... })对这些语句进行分组。</dd>
</dl>
-<h2 id="Description" name="Description">描述</h2>
+<h2 id="Description">描述</h2>
<p>JavaScript查找某个未使用命名空间的变量时,会通过作用域链来查找,作用域链是跟执行代码的context或者包含这个变量的函数有关。'with'语句将某个对象添加到作用域链的顶部,如果在statement中有某个未使用命名空间的变量,跟作用域链中的某个属性同名,则这个变量将指向这个属性值。如果沒有同名的属性,则将拋出{{jsxref("ReferenceError")}}异常。</p>
@@ -63,9 +63,9 @@ translation_of: Web/JavaScript/Reference/Statements/with
<p>如果是在ECMAScript 5环境调用<code>f([1,2,3], obj)</code>,则<code>with</code>语句中变量<code>values</code>将指向函数的第二个参数<code>values</code>。但是,ECMAScript 6标准给<code><a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype">Array.prototype</a></code>添加了一个新属性<code>values</code>,所有数组实例将继承这个属性。所以在ECMAScript 6环境中,<code>with</code>语句中变量<code>values</code>将指向<code>[1,2,3].values</code>。</p>
</div>
-<h2 id="Examples" name="Examples">示例</h2>
+<h2 id="Examples">示例</h2>
-<h3 id="Example_Using_with" name="Example:_Using_with">Example: Using <code>with</code></h3>
+<h3 id="Example_Using_with">Example: Using <code>with</code></h3>
<p>下面的<code>with</code>语句指定<code><a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Math" title="JavaScript/Reference/Global_Objects/Math">Math</a></code>对象作为默认对象。<code>with</code>语句里面的变量,分別指向<code>Math</code>对象的<a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/PI" title="JavaScript/Reference/Global_Objects/Math/PI"><code>PI</code></a> 、<code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos" title="JavaScript/Reference/Global_Objects/Math/cos">cos</a>和</code><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin" title="JavaScript/Reference/Global_Objects/Math/sin">sin</a></code>函数,不用在前面添加命名空间。后续所有引用都指向<code>Math</code>对象。</p>
@@ -119,7 +119,7 @@ with (Math) {
<p>{{Compat("javascript.statements.with")}}</p>
-<h2 id="See_also" name="See_also">相关链接</h2>
+<h2 id="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Statements/block", "block")}}</li>