diff options
author | Irvin <irvinfly@gmail.com> | 2022-02-16 02:02:49 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | 01b0e12ba27b5069248fd09235e9a7143915ee30 (patch) | |
tree | 0e9edf538dc3fa3331e1dbb79239b58186765f86 /files/zh-cn/web/javascript/reference/global_objects/boolean/index.html | |
parent | 6ca84f1794af830ada9736d7289ce29aabb04ca3 (diff) | |
download | translated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.tar.gz translated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.tar.bz2 translated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.zip |
remove `notranslate` class in zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/boolean/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/boolean/index.html | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/boolean/index.html b/files/zh-cn/web/javascript/reference/global_objects/boolean/index.html index a236f20273..4101843056 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/boolean/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/boolean/index.html @@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Boolean <p>其值不是{{jsxref("undefined")}}或{{jsxref("null")}}的任何对象(包括其值为<code>false</code>的布尔对象)在传递给条件语句时都将计算为<code>true</code>。 例如,以下{{jsxref("Statements/if...else", "if")}}语句中的条件评估为<code>true</code>:</p> -<pre class="brush: js notranslate">var x = new Boolean(false); +<pre class="brush: js">var x = new Boolean(false); if (x) { // 这里的代码会被执行 } @@ -27,7 +27,7 @@ if (x) { <p>基本类型的布尔值不受此规则影响。例如下面的 {{jsxref("Statements/if...else", "if")}} 语句的条件为假:</p> -<pre class="brush: js notranslate">var x = false; +<pre class="brush: js">var x = false; if (x) { // 这里的代码不会执行 } @@ -35,14 +35,14 @@ if (x) { <p>不要用创建 <code>Boolean</code> 对象的方式将一个非布尔值转化成布尔值,直接将 <code>Boolean</code> 当做转换函数来使用即可,或者使用<a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Logical_Operators#%E9%80%BB%E8%BE%91%E9%9D%9E%EF%BC%88!%EF%BC%89">双重非(!!)运算符</a>:</p> -<pre class="brush: js notranslate">var x = Boolean(expression); // 推荐 +<pre class="brush: js">var x = Boolean(expression); // 推荐 var x = !!(expression); // 推荐 var x = new Boolean(expression); // 不太好 </pre> <p>对于任何对象,即使是值为 <code>false</code> 的 <code>Boolean</code> 对象,当将其传给 <code>Boolean</code> 函数时,生成的 <code>Boolean</code> 对象的值都是 <code>true</code>。</p> -<pre class="brush: js notranslate">var myFalse = new Boolean(false); // true +<pre class="brush: js">var myFalse = new Boolean(false); // true var g = new Boolean(myFalse); // true var myString = new String("Hello"); var s = new Boolean(myString); // true @@ -74,7 +74,7 @@ var s = new Boolean(myString); // true <h3 id="创建值为_false_的_Boolean_对象">创建值为 <code>false</code> 的 <code>Boolean</code> 对象</h3> -<pre class="brush: js notranslate">var bNoParam = new Boolean(); +<pre class="brush: js">var bNoParam = new Boolean(); var bZero = new Boolean(0); var bNull = new Boolean(null); var bEmptyString = new Boolean(''); @@ -83,7 +83,7 @@ var bfalse = new Boolean(false); <h3 id="创建值为_true_的_Boolean_对象">创建值为 <code>true</code> 的 <code>Boolean</code> 对象</h3> -<pre class="brush: js notranslate">var btrue = new Boolean(true); +<pre class="brush: js">var btrue = new Boolean(true); var btrueString = new Boolean('true'); var bfalseString = new Boolean('false'); var bSuLin = new Boolean('Su Lin'); |