diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/statements')
3 files changed, 4 insertions, 4 deletions
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 ea26ed78af..8b57fa8188 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 @@ -78,7 +78,7 @@ else } </pre> -<p>不要将原始布尔值的<code>true</code>和<code>false</code>与<a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Boolean" title="en/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>对象的真或假混淆。任何一个值,只要它不是 <code>undefined</code><font face="Open Sans, Arial, sans-serif">、</font><code>null</code>、<code>false</code>、 <code>0</code><font face="Open Sans, Arial, sans-serif">、</font><code>NaN</code>或空字符串(<code>""</code>),那么无论是任何对象,即使是值为假的Boolean对象,在条件语句中都为真。例如:</p> +<p>不要将原始布尔值的<code>true</code>和<code>false</code>与<a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Boolean" title="en/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>对象的真或假混淆。任何一个值,只要它不是 <code>undefined</code>、<code>null</code>、 <code>0</code>、<code>NaN</code>或空字符串(<code>""</code>),那么无论是任何对象,即使是值为假的Boolean对象,在条件语句中都为真。例如:</p> <pre class="brush: js">var b = new Boolean(false); if (b) //表达式的值为true diff --git a/files/zh-cn/web/javascript/reference/statements/import/index.html b/files/zh-cn/web/javascript/reference/statements/import/index.html index 0c7f0a0a4f..eac05517ff 100644 --- a/files/zh-cn/web/javascript/reference/statements/import/index.html +++ b/files/zh-cn/web/javascript/reference/statements/import/index.html @@ -99,7 +99,7 @@ var promise = import("module-name");//这是一个处于第三阶段的提案。 <h3 id="导入默认值">导入默认值</h3> -<p><code><font face="Arial, x-locale-body, sans-serif">引入模块可能有一个</font>default</code>{{jsxref("Statements/export", "export")}}(无论它是对象,函数,类等)可用。然后可以使用<code>import</code>语句来导入这样的默认接口。</p> +<p><code>引入模块可能有一个default</code>{{jsxref("Statements/export", "export")}}(无论它是对象,函数,类等)可用。然后可以使用<code>import</code>语句来导入这样的默认接口。</p> <p>最简单的用法是直接导入默认值:</p> 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 b4ff4753b2..32ce03679b 100644 --- a/files/zh-cn/web/javascript/reference/statements/with/index.html +++ b/files/zh-cn/web/javascript/reference/statements/with/index.html @@ -60,14 +60,14 @@ translation_of: Web/JavaScript/Reference/Statements/with } </pre> -<p><font face="Open Sans, Arial, sans-serif">如果是在</font>ECMAScript 5环境调用<code>f([1,2,3], obj)</code>,则<code><font face="Open Sans, Arial, sans-serif">with</font></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><font face="Open Sans, Arial, sans-serif">with</font></code>语句中变量<code>values</code>将指向<code>[1,2,3].values</code>。</p> +<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> <h3 id="Example_Using_with" name="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><font face="Open Sans, Arial, sans-serif">和</font></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> +<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> <pre class="brush:js notranslate">var a, x, y; var r = 10; |