diff options
Diffstat (limited to 'files/zh-cn/web/javascript/guide/expressions_and_operators')
-rw-r--r-- | files/zh-cn/web/javascript/guide/expressions_and_operators/index.html | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/files/zh-cn/web/javascript/guide/expressions_and_operators/index.html b/files/zh-cn/web/javascript/guide/expressions_and_operators/index.html index bced40f16d..cd87597de3 100644 --- a/files/zh-cn/web/javascript/guide/expressions_and_operators/index.html +++ b/files/zh-cn/web/javascript/guide/expressions_and_operators/index.html @@ -368,7 +368,7 @@ var var2 = 4;</pre> </tbody> </table> -<h4 id="Bitwise_Logical_Operators" name="Bitwise_Logical_Operators">位逻辑运算符</h4> +<h4 id="Bitwise_Logical_Operators">位逻辑运算符</h4> <p>概念上来讲, 位逻辑运算符工作流程如下:</p> @@ -430,7 +430,7 @@ After: 10100000000000000110000000000001</code></pre> <p>注意位运算符“非”将所有的32位取反,而值的最高位(最左边的一位)为1则表示负数(2-补码表示法)。</p> -<h4 id="Bitwise_Shift_Operators" name="Bitwise_Shift_Operators">移位运算符</h4> +<h4 id="Bitwise_Shift_Operators">移位运算符</h4> <p>移位运算符带两个操作数:第一个是待移位的数,第二个是指定第一个数要被移多少位的数。移位的方向由运算符来控制.</p> @@ -534,7 +534,7 @@ var n2 = !false; // !f returns true var n3 = !"Cat"; // !t returns false </pre> -<h4 id="Short-Circuit_Evaluation" name="Short-Circuit_Evaluation">短路求值</h4> +<h4 id="Short-Circuit_Evaluation">短路求值</h4> <p>作为逻辑表达式进行求值是从左到右,它们是为可能的“短路”的出现而使用以下规则进行测试:</p> @@ -560,7 +560,7 @@ var n3 = !"Cat"; // !t returns false <code>myString += "bet"; // 返回 "alphabet" </code> </pre> -<h3 id="conditional_operator" name="conditional_operator">条件(三元)运算符</h3> +<h3 id="conditional_operator">条件(三元)运算符</h3> <p><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Conditional_Operator">条件运算符</a>是JavaScript中唯一需要三个操作数的运算符。运算的结果根据给定条件在两个值中取其一。语法为:</p> @@ -576,7 +576,7 @@ var n3 = !"Cat"; // !t returns false <p>当 <code>age</code> 大于等于18的时候,将“adult”赋值给<code> status</code>;否则将“minor”赋值给 <code>status</code>。</p> -<h3 id="comma_operator" name="comma_operator">逗号操作符</h3> +<h3 id="comma_operator">逗号操作符</h3> <p><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Comma_Operator">逗号操作符</a>(<code>,</code>)对两个操作数进行求值并返回最终操作数的值。它常常用在 <code>for</code> 循环中,在每次循环时对多个变量进行更新。</p> @@ -588,11 +588,11 @@ var a = [x, x, x, x, x]; for (var i = 0, j = 9; i <= j; i++, j--) console.log('a[' + i + '][' + j + ']= ' + a[i][j]);</pre> -<h3 id="delete" name="delete">一元操作符</h3> +<h3 id="delete">一元操作符</h3> <p>一元操作符仅对应一个操作数。</p> -<h4 id="delete" name="delete"><code>delete</code></h4> +<h4 id="delete"><code>delete</code></h4> <p><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete">delete</a></code>操作符,删除一个对象的属性或者一个数组中某一个键值。语法如下:</p> @@ -642,7 +642,7 @@ if (3 in trees) { } </pre> -<h4 id="typeof" name="typeof"><code>typeof</code></h4> +<h4 id="typeof"><code>typeof</code></h4> <p><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/typeof">typeof操作符</a> 可通过下面2种方式使用:</p> @@ -705,7 +705,7 @@ typeof Option; // returns "function" typeof String; // returns "function" </pre> -<h4 id="void" name="void"><code>void</code></h4> +<h4 id="void"><code>void</code></h4> <p>void 运算符运用方法如下:</p> @@ -730,7 +730,7 @@ Click here to submit</a></pre> <p>关系操作符对操作数进行比较,根据比较结果真或假,返回相应的布尔值。</p> -<h4 id="in" name="in"><code>in</code></h4> +<h4 id="in"><code>in</code></h4> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in"><code>in</code>操作符</a>,如果所指定的<strong>属性</strong>确实存在于所指定的对象中,则会返回<code>true</code>,语法如下:</p> @@ -761,7 +761,7 @@ var mycar = {make: "Honda", model: "Accord", year: 1998}; "model" in mycar; // returns true </pre> -<h4 id="instanceof" name="instanceof"><code>instanceof</code></h4> +<h4 id="instanceof"><code>instanceof</code></h4> <p>如果所判别的对象确实是所指定的类型,则返回<code>true</code>。其语法如下:</p> @@ -885,9 +885,9 @@ if (theDay instanceof Date) { <li>左值表达式: 分配给左值。</li> </ul> -<h3 id="new" name="new">基本表达式</h3> +<h3 id="new">基本表达式</h3> -<h4 id="this" name="this"><code>this</code></h4> +<h4 id="this"><code>this</code></h4> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this"><code>this</code></a>关键字被用于指代当前的对象,通常,<code>this</code>指代的是方法中正在被调用的对象。用法如下:</p> @@ -952,7 +952,7 @@ var abc = [ "A", "B", "C" ]; <p>左值可以作为赋值的目标。</p> -<h4 id="new" name="new"><code>new</code></h4> +<h4 id="new"><code>new</code></h4> <p>你可以使用<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new"><code>new</code> operator</a> 创建一个自定义类型或者是<code>预置类型</code>的对象实例。用法如下:</p> |