diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/operators')
8 files changed, 14 insertions, 14 deletions
diff --git a/files/zh-cn/web/javascript/reference/operators/assignment/index.html b/files/zh-cn/web/javascript/reference/operators/assignment/index.html index eba07d8890..8c981fe11e 100644 --- a/files/zh-cn/web/javascript/reference/operators/assignment/index.html +++ b/files/zh-cn/web/javascript/reference/operators/assignment/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Operators/Assignment --- <div>{{jsSidebar("Operators")}}</div> -<p><span>简单赋值操作符(=)用于为变量赋值。赋值表达式本身的值为其完成后被赋值的变量的值。为了给多个变量赋一个值,可以链式使用赋值操作符。</span></p> +<p>简单赋值操作符(=)用于为变量赋值。赋值表达式本身的值为其完成后被赋值的变量的值。为了给多个变量赋一个值,可以链式使用赋值操作符。</p> <div>{{EmbedInteractiveExample("pages/js/expressions-assignment.html")}}</div> diff --git a/files/zh-cn/web/javascript/reference/operators/bitwise_not/index.html b/files/zh-cn/web/javascript/reference/operators/bitwise_not/index.html index d0dfd8ca78..61c6487896 100644 --- a/files/zh-cn/web/javascript/reference/operators/bitwise_not/index.html +++ b/files/zh-cn/web/javascript/reference/operators/bitwise_not/index.html @@ -59,7 +59,7 @@ After: 10100000000000000110000000000001</pre> ~9 (base 10) = 11111111111111111111111111110110 (base 2) = -10 (base 10) </pre> -<p>按位非运算时,任何数字<code>x<font face="Arial, x-locale-body, sans-serif"><span style="background-color: #ffffff;">的运算结果都是</span></font></code><code>-(x + 1)</code>。例如,<code>〜-5</code>运算结果为<code>4</code>。</p> +<p>按位非运算时,任何数字<code>x<font face="Arial, x-locale-body, sans-serif">的运算结果都是</font></code><code>-(x + 1)</code>。例如,<code>〜-5</code>运算结果为<code>4</code>。</p> <p>Note that due to using 32-bit representation for numbers both <code>~-1</code> and <code>~4294967295</code> (2<sup>32</sup>-1) results in <code>0</code>.</p> diff --git a/files/zh-cn/web/javascript/reference/operators/delete/index.html b/files/zh-cn/web/javascript/reference/operators/delete/index.html index 6b0486084e..f460f0e268 100644 --- a/files/zh-cn/web/javascript/reference/operators/delete/index.html +++ b/files/zh-cn/web/javascript/reference/operators/delete/index.html @@ -287,7 +287,7 @@ console.log(trees); // ["redwood", "bay", "cedar", "maple"] <p>尽管ECMAScript使得对象的迭代顺序依赖于实现,但似乎所有主流浏览器都支持基于最早添加的属性(至少对于不在原型上的属性)的迭代顺序(译注:ES5 标准取消了属性遍历的顺序的规定)。但是,在 IE 中,使用 <code>delete</code> 删除一个属性后,奇怪的事情发生了。在IE中,如果被删除的属性重新被添加,那么遍历时,该属性的顺序会在上次删除前的那个位置,而不是出现在遍历的最后一个。</p> -<p>如果您想在跨浏览器的环境中使用有序的关联数组,请使用{{jsxref("Map")}}对象(如果有),或使用两个单独的数组来模拟(一个用于键,另一个用于 值),或者建立<span class="short_text" id="result_box" lang="zh-CN"><span>一个</span><span>由单一</span><span>属性</span><span>的</span><span>对象组成的</span><span>数组</span></span>等。</p> +<p>如果您想在跨浏览器的环境中使用有序的关联数组,请使用{{jsxref("Map")}}对象(如果有),或使用两个单独的数组来模拟(一个用于键,另一个用于 值),或者建立一个由单一属性的对象组成的数组等。</p> <h2 id="See_also" name="See_also">参见</h2> diff --git a/files/zh-cn/web/javascript/reference/operators/function/index.html b/files/zh-cn/web/javascript/reference/operators/function/index.html index 73939d3da0..275ea3a02a 100644 --- a/files/zh-cn/web/javascript/reference/operators/function/index.html +++ b/files/zh-cn/web/javascript/reference/operators/function/index.html @@ -36,13 +36,13 @@ translation_of: Web/JavaScript/Reference/Operators/function <h2 id="Description" name="Description">描述</h2> -<p>函数表达式(function expression)非常类似于函数声明(function statement)<span style="line-height: 1.5;">(详情查看</span><a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/function" style="line-height: 1.5;">函数声明</a><span style="line-height: 1.5;">)</span><span style="line-height: 1.5;">,并且两者拥有几乎相同的语法。</span><span style="line-height: 1.5;">函数表达式与函数声明的最主要区别是函数名称(</span><em>function name</em><span style="line-height: 1.5;">),在函数表达式中可省略它,从而创建匿名函数(</span><em>anonymous</em><span style="line-height: 1.5;"> functions)。</span>一个函数表达式可以被用作一个IIFE(Immediately Invoked Function Expression,即时调用的函数表达式),它一旦定义就运行。<span style="line-height: 1.5;">更多信息请查看</span><a href="/zh-CN/docs/Web/JavaScript/Reference/Functions_and_function_scope" style="line-height: 1.5;">函数</a><span style="line-height: 1.5;">。</span></p> +<p>函数表达式(function expression)非常类似于函数声明(function statement)(详情查看<a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/function" style="line-height: 1.5;">函数声明</a>),并且两者拥有几乎相同的语法。函数表达式与函数声明的最主要区别是函数名称(<em>function name</em>),在函数表达式中可省略它,从而创建匿名函数(<em>anonymous</em> functions)。一个函数表达式可以被用作一个IIFE(Immediately Invoked Function Expression,即时调用的函数表达式),它一旦定义就运行。更多信息请查看<a href="/zh-CN/docs/Web/JavaScript/Reference/Functions_and_function_scope" style="line-height: 1.5;">函数</a>。</p> <h3 id="函数表达式提升_(Function_expression_hoisting)"> 函数表达式提升 (Function expression hoisting)</h3> <p>JavaScript中的函数表达式没有提升,不像函数声明,你在定义函数表达式之前不能使用函数表达式:</p> -<pre class="brush: js"><code><font color="#333333" face="Open Sans, arial, sans-serif" size="3"><span style="background-color: #ffffff; white-space: normal;"> </span></font>notHoisted(); // TypeError: notHoisted is not a function +<pre class="brush: js"><code><font color="#333333" face="Open Sans, arial, sans-serif" size="3"> </font>notHoisted(); // TypeError: notHoisted is not a function var notHoisted = function() { console.log('bar'); diff --git a/files/zh-cn/web/javascript/reference/operators/new/index.html b/files/zh-cn/web/javascript/reference/operators/new/index.html index dac61b1b8c..488a6a647b 100644 --- a/files/zh-cn/web/javascript/reference/operators/new/index.html +++ b/files/zh-cn/web/javascript/reference/operators/new/index.html @@ -10,7 +10,7 @@ translation_of: Web/JavaScript/Reference/Operators/new --- <div>{{jsSidebar("Operators")}}</div> -<p><span class="seoSummary"><strong><code>new</code> 运算符</strong>创建一个用户定义的对象类型的实例或具有构造函数的内置对象的实例。</span></p> +<p><strong><code>new</code> 运算符</strong>创建一个用户定义的对象类型的实例或具有构造函数的内置对象的实例。</p> <ol> </ol> @@ -39,12 +39,12 @@ translation_of: Web/JavaScript/Reference/Operators/new <ol> <li>创建一个空的简单JavaScript对象(即<code><strong>{}</strong></code>);</li> - <li>为步骤1新创建的对象添加属性<font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);"><strong>__proto__</strong></span></font>,将该属性链接至构造函数的原型对象 ;</li> + <li>为步骤1新创建的对象添加属性<font face="consolas, Liberation Mono, courier, monospace"><strong>__proto__</strong></font>,将该属性链接至构造函数的原型对象 ;</li> <li>将步骤1新创建的对象作为<code><strong>this</strong></code>的上下文 ;</li> <li>如果该函数没有返回对象,则返回<code><strong>this</strong></code>。</li> </ol> -<p>(译注:关于对象的 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);"><strong>constructor</strong></span></font>,参见 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);"><strong>Object.prototype.constructor</strong></span></font>)</p> +<p>(译注:关于对象的 <font face="consolas, Liberation Mono, courier, monospace"><strong>constructor</strong></font>,参见 <font face="consolas, Liberation Mono, courier, monospace"><strong>Object.prototype.constructor</strong></font>)</p> <p>创建一个用户自定义的对象需要两步:</p> diff --git a/files/zh-cn/web/javascript/reference/operators/nullish_coalescing_operator/index.html b/files/zh-cn/web/javascript/reference/operators/nullish_coalescing_operator/index.html index 2dff76dbbd..5459522ff7 100644 --- a/files/zh-cn/web/javascript/reference/operators/nullish_coalescing_operator/index.html +++ b/files/zh-cn/web/javascript/reference/operators/nullish_coalescing_operator/index.html @@ -53,7 +53,7 @@ console.log(valC); // 42</pre> // foo is never assigned any value so it is still undefined let someDummyText = foo || 'Hello!';</pre> -<p>然而,由于 <code>||</code> 是一个布尔逻辑运算符,左侧的操作数会被强制转换成布尔值用于求值。任何假值(<code>0</code>, <code>''</code>, <code>NaN</code>, <code>null</code>, <code>undefined</code>)都不会被返回。这导致如果你使用<code>0</code>,<code>''</code><font face="Arial, x-locale-body, sans-serif"><span style="background-color: #ffffff;">或</span></font><code>NaN</code>作为有效值,就会出现不可预料的后果。</p> +<p>然而,由于 <code>||</code> 是一个布尔逻辑运算符,左侧的操作数会被强制转换成布尔值用于求值。任何假值(<code>0</code>, <code>''</code>, <code>NaN</code>, <code>null</code>, <code>undefined</code>)都不会被返回。这导致如果你使用<code>0</code>,<code>''</code><font face="Arial, x-locale-body, sans-serif">或</font><code>NaN</code>作为有效值,就会出现不可预料的后果。</p> <pre class="brush: js notranslate">let count = 0; let text = ""; diff --git a/files/zh-cn/web/javascript/reference/operators/strict_inequality/index.html b/files/zh-cn/web/javascript/reference/operators/strict_inequality/index.html index e71f28c100..a31aa575d1 100644 --- a/files/zh-cn/web/javascript/reference/operators/strict_inequality/index.html +++ b/files/zh-cn/web/javascript/reference/operators/strict_inequality/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Operators/Strict_inequality --- <div>{{jsSidebar("Operators")}}</div> -<p><span>严格不等式操作符(!==)检查它的两个对象是否不相等,返回一个布尔结果。与不等式运算符不同,严格不等式运算符总是认为不同类型的对象是不同的。</span></p> +<p>严格不等式操作符(!==)检查它的两个对象是否不相等,返回一个布尔结果。与不等式运算符不同,严格不等式运算符总是认为不同类型的对象是不同的。</p> <div>{{EmbedInteractiveExample("pages/js/expressions-strict-equality.html")}}</div> @@ -17,15 +17,15 @@ translation_of: Web/JavaScript/Reference/Operators/Strict_inequality <h2 id="描述">描述</h2> -<p><span>严格不等式运算符检查其对象是否不相等。它是严格相等运算符的否定,因此下面两行总是会给出相同的结果:</span></p> +<p>严格不等式运算符检查其对象是否不相等。它是严格相等运算符的否定,因此下面两行总是会给出相同的结果:</p> <pre class="brush: js notranslate">x !== y !(x === y)</pre> -<p><span>有关比较算法的详细信息,请参阅严格相等运算符的页面。</span></p> +<p>有关比较算法的详细信息,请参阅严格相等运算符的页面。</p> -<p><span>与严格相等运算符一样,严格不等运算符始终认为不同类型的对象是不同的</span>:</p> +<p>与严格相等运算符一样,严格不等运算符始终认为不同类型的对象是不同的:</p> <pre class="brush: js notranslate">3 !== "3"; // true</pre> diff --git a/files/zh-cn/web/javascript/reference/operators/this/index.html b/files/zh-cn/web/javascript/reference/operators/this/index.html index a53b49cb60..aea931541f 100644 --- a/files/zh-cn/web/javascript/reference/operators/this/index.html +++ b/files/zh-cn/web/javascript/reference/operators/this/index.html @@ -328,7 +328,7 @@ console.log(o.average, o.sum); // logs 2, 6 <p>当一个函数用作构造函数时(使用<a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/new">new</a>关键字),它的<code>this</code>被绑定到正在构造的新对象。</p> <div class="note"> -<p><span style="line-height: 22.007999420166px;">虽然构造函数返回的默认值是 <code>this</code> 所指的那个对象,但它仍可以手动返回其他的对象(如果返回值不是一个对象,则返回 <code>this</code> 对象)。</span></p> +<p>虽然构造函数返回的默认值是 <code>this</code> 所指的那个对象,但它仍可以手动返回其他的对象(如果返回值不是一个对象,则返回 <code>this</code> 对象)。</p> </div> <pre class="brush: js notranslate">/* |