diff options
author | t7yang <t7yang@gmail.com> | 2021-07-17 16:10:02 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2021-07-19 23:04:27 +0800 |
commit | a02f4b2f60c81e09b318a090e5c9c2d2d641c878 (patch) | |
tree | 2b1849e7a34cb367ff6624e35a35fc827eceef6b /files/zh-cn/web/javascript | |
parent | 8af4d5e8a260f3474b4273d573532ec6fec08ab4 (diff) | |
download | translated-content-a02f4b2f60c81e09b318a090e5c9c2d2d641c878.tar.gz translated-content-a02f4b2f60c81e09b318a090e5c9c2d2d641c878.tar.bz2 translated-content-a02f4b2f60c81e09b318a090e5c9c2d2d641c878.zip |
replace wiki links in zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript')
19 files changed, 36 insertions, 36 deletions
diff --git a/files/zh-cn/web/javascript/closures/index.html b/files/zh-cn/web/javascript/closures/index.html index 4c84f51dd9..9c14c74c62 100644 --- a/files/zh-cn/web/javascript/closures/index.html +++ b/files/zh-cn/web/javascript/closures/index.html @@ -331,7 +331,7 @@ setupHelp();</pre> <p>这个例子使用<code>let</code>而不是<code>var</code>,因此每个闭包都绑定了块作用域的变量,这意味着不再需要额外的闭包。</p> -<p>另一个可选方案是使用 <code>forEach()</code>来遍历<code>helpText</code>数组并给每一个<code><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/HTML/Element/p" title="The HTML <p> element represents a paragraph."><p></a></code>添加一个监听器,如下所示:</p> +<p>另一个可选方案是使用 <code>forEach()</code>来遍历<code>helpText</code>数组并给每一个<code><a href="/zh-CN/docs/Web/HTML/Element/p" title="The HTML <p> element represents a paragraph."><p></a></code>添加一个监听器,如下所示:</p> <pre class="notranslate">function showHelp(help) { document.getElementById('help').innerHTML = help; diff --git a/files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html b/files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html index a9ef01776b..2a80a615fe 100644 --- a/files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html +++ b/files/zh-cn/web/javascript/guide/regular_expressions/assertions/index.html @@ -245,19 +245,19 @@ console.log(ripe_oranges); // [ 'ripe orange A ', 'ripe orange C' ]</pre> <h2 id="浏览器_兼容性">浏览器 兼容性</h2> -<p>有关浏览器兼容性的信息,请查看 <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Browser_compatibility">main Regular Expressions compatibility table</a>.</p> +<p>有关浏览器兼容性的信息,请查看 <a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions#Browser_compatibility">main Regular Expressions compatibility table</a>.</p> <h2 id="另请参阅">另请参阅</h2> <ul> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">正则表达式指南</a> + <li><a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions">正则表达式指南</a> <ul> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes">字符类</a></li> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Quantifiers">量词</a> </li> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes">Unicode 属性转义</a></li> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges">组和范围</a></li> + <li><a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes">字符类</a></li> + <li><a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions/Quantifiers">量词</a> </li> + <li><a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes">Unicode 属性转义</a></li> + <li><a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges">组和范围</a></li> </ul> </li> - <li> <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp() 构造器</a></li> + <li> <a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp() 构造器</a></li> </ul> diff --git a/files/zh-cn/web/javascript/reference/classes/index.html b/files/zh-cn/web/javascript/reference/classes/index.html index 5c91d8d219..89045127bf 100644 --- a/files/zh-cn/web/javascript/reference/classes/index.html +++ b/files/zh-cn/web/javascript/reference/classes/index.html @@ -67,7 +67,7 @@ console.log(Rectangle.name); // 输出: "Rectangle2"</pre> <div class="blockIndicator note"> -<p><strong>注意:</strong> 类<strong>表达式</strong>也同样受到<a href="https://wiki.developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Classes$edit#Class_declarations">类声明</a>部分中提到的类型提升的限制。</p> +<p><strong>注意:</strong> 类<strong>表达式</strong>也同样受到<a href="/zh-CN/docs/Web/JavaScript/Reference/Classes$edit#Class_declarations">类声明</a>部分中提到的类型提升的限制。</p> </div> <h2 id="类体和方法定义">类体和方法定义</h2> diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/index.html index 22ec42ac8f..937a5f7e7c 100644 --- a/files/zh-cn/web/javascript/reference/functions/arguments/index.html +++ b/files/zh-cn/web/javascript/reference/functions/arguments/index.html @@ -26,11 +26,11 @@ translation_of: Web/JavaScript/Reference/Functions/arguments <h2 id="Description" name="Description">描述</h2> <div class="blockIndicator note"> -<p><strong>Note:</strong> If you're writing ES6 compatible code, then <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest parameters</a> should be preferred.</p> +<p><strong>Note:</strong> If you're writing ES6 compatible code, then <a href="/zh-CN/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest parameters</a> should be preferred.</p> </div> <div class="blockIndicator note"> -<p><strong>Note:</strong> “Array-like” means that <code>arguments</code> has a {{jsxref("Functions/arguments/length", "length")}} property and properties indexed from zero, but it doesn't have {{JSxRef("Array")}}'s built-in methods like {{jsxref("Array.forEach", "forEach()")}} and {{jsxref("Array.map", "map()")}}. See <a href="https://wiki.developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/arguments$edit#Description">§Description</a> for details.</p> +<p><strong>Note:</strong> “Array-like” means that <code>arguments</code> has a {{jsxref("Functions/arguments/length", "length")}} property and properties indexed from zero, but it doesn't have {{JSxRef("Array")}}'s built-in methods like {{jsxref("Array.forEach", "forEach()")}} and {{jsxref("Array.map", "map()")}}. See <a href="/zh-CN/docs/Web/JavaScript/Reference/Functions/arguments$edit#Description">§Description</a> for details.</p> </div> <p><code>arguments</code>对象是所有(非箭头)函数中都可用的<strong>局部变量</strong>。你可以使用<code>arguments</code>对象在函数中引用函数的参数。此对象包含传递给函数的每个参数,第一个参数在索引0处。例如,如果一个函数传递了三个参数,你可以以如下方式引用他们:</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html b/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html index 1ef191efc0..225cda75d6 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html @@ -161,7 +161,7 @@ Boolean(12n) <h2 id="构造器">构造器</h2> <dl> - <dt><code><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/BigInt">BigInt()</a></code></dt> + <dt><code><a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/BigInt/BigInt">BigInt()</a></code></dt> <dd>创建{{jsxref("BigInt")}} 对象。</dd> </dl> diff --git a/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html b/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html index c7f47fef77..31ac75a13e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/BigInt64Array <h2 id="构造函数">构造函数</h2> -<p><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array"><code>BigInt64Array()</code></a></p> +<p><a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array"><code>BigInt64Array()</code></a></p> <p> 添加一个新的<code>BigInt64Array</code>对象。</p> @@ -167,7 +167,7 @@ var bigint64 = new BigInt64Array(iterable); <h2 id="参考">参考</h2> <ul> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays" title="en/JavaScript typed arrays">JavaScript typed arrays</a></li> + <li><a href="/zh-CN/docs/Web/JavaScript/Typed_arrays" title="en/JavaScript typed arrays">JavaScript typed arrays</a></li> <li>{{jsxref("BigUint64Array")}}</li> <li>{{jsxref("DataView")}}</li> </ul> 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 9b0ba4ae06..a236f20273 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 @@ -51,13 +51,13 @@ var s = new Boolean(myString); // true <p>最后,不要在应该使用基本类型布尔值的地方使用 <code>Boolean</code> 对象。</p> <div class="blockIndicator note"> -<p><strong>注意:</strong>当将非标准属性<a href="https://wiki.developer.mozilla.org/en-US/docs/Web/API/Document#Properties">document.all</a>用作此构造函数的参数时,结果是值为<code>false</code>的布尔对象。 此属性是旧属性,是非标准属性,不应使用。</p> +<p><strong>注意:</strong>当将非标准属性<a href="/zh-CN/docs/Web/API/Document#Properties">document.all</a>用作此构造函数的参数时,结果是值为<code>false</code>的布尔对象。 此属性是旧属性,是非标准属性,不应使用。</p> </div> <h2 id="构造器">构造器</h2> <dl> - <dt><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/Boolean"><code>Boolean()</code></a></dt> + <dt><a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Boolean/Boolean"><code>Boolean()</code></a></dt> <dd>创建一个新的<code>Boolean</code> 对象。</dd> </dl> diff --git a/files/zh-cn/web/javascript/reference/global_objects/encodeuricomponent/index.html b/files/zh-cn/web/javascript/reference/global_objects/encodeuricomponent/index.html index d80cd457c9..be7f03a446 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/encodeuricomponent/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/encodeuricomponent/index.html @@ -9,7 +9,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/encodeURIComponent --- <div>{{jsSidebar("Objects")}}</div> -<p><code><strong>encodeURIComponent()</strong></code>函数通过将一个,两个,三个或四个表示字符的UTF-8编码的转义序列替换某些字符的每个实例来编码 <a href="https://wiki.developer.mozilla.org/en-US/docs/Glossary/URI">URI</a> (对于由两个“代理”字符组成的字符而言,将仅是四个转义序列) 。</p> +<p><code><strong>encodeURIComponent()</strong></code>函数通过将一个,两个,三个或四个表示字符的UTF-8编码的转义序列替换某些字符的每个实例来编码 <a href="/zh-CN/docs/Glossary/URI">URI</a> (对于由两个“代理”字符组成的字符而言,将仅是四个转义序列) 。</p> <p>{{EmbedInteractiveExample("pages/js/globalprops-encodeuricomponent.html","shorter")}}</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/globalthis/index.html b/files/zh-cn/web/javascript/reference/global_objects/globalthis/index.html index 20b6dba280..7260d8cbfa 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/globalthis/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/globalthis/index.html @@ -30,7 +30,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/globalThis <p>在以前,从不同的 JavaScript 环境中获取全局对象需要不同的语句。在 Web 中,可以通过 <code>window</code>、<code>self</code> 或者 <code>frames</code> 取到全局对象,但是在 <a href="/zh-CN/docs/Web/API/Worker">Web Workers</a> 中,只有 <code>self</code> 可以。在 Node.js 中,它们都无法获取,必须使用 <code>global</code>。</p> -<p>在松散模式下,可以在函数中返回 <code>this</code> 来获取全局对象,但是在严格模式和模块环境下,<code>this</code> 会返回 <code>undefined</code>。 You can also use <code>Function('return this')()</code>, but environments that disable {{jsxref("eval", "eval()")}}, like <a href="https://wiki.developer.mozilla.org/en-US/docs/Glossary/CSP">CSP</a> in browsers, prevent use of {{jsxref("Function")}} in this way.</p> +<p>在松散模式下,可以在函数中返回 <code>this</code> 来获取全局对象,但是在严格模式和模块环境下,<code>this</code> 会返回 <code>undefined</code>。 You can also use <code>Function('return this')()</code>, but environments that disable {{jsxref("eval", "eval()")}}, like <a href="/zh-CN/docs/Glossary/CSP">CSP</a> in browsers, prevent use of {{jsxref("Function")}} in this way.</p> <p><code>globalThis</code> 提供了一个标准的方式来获取不同环境下的全局 <code>this</code> 对象(也就是全局对象自身)。不像 <code>window</code> 或者 <code>self</code> 这些属性,它确保可以在有无窗口的各种环境下正常工作。所以,你可以安心的使用 <code>globalThis</code>,不必担心它的运行环境。为便于记忆,你只需要记住,全局作用域中的 <code>this</code> 就是 <code>globalThis</code>。</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/random/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/random/index.html index ea760c65f6..efc11b6894 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/random/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/random/index.html @@ -90,5 +90,5 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random <h2 id="相关链接">相关链接</h2> <ul> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues" title="The documentation about this has not yet been written; please consider contributing!"><code>window.crypto.getRandomValues()</code></a></li> + <li><a href="/zh-CN/docs/Web/API/RandomSource/getRandomValues" title="The documentation about this has not yet been written; please consider contributing!"><code>window.crypto.getRandomValues()</code></a></li> </ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html index abe605e620..1e1080be00 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html @@ -51,7 +51,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/assign <h2 id="Polyfill_2">Polyfill</h2> -<p>这个 <a href="https://wiki.developer.mozilla.org/en-US/docs/Glossary/Polyfill">polyfill</a> 不支持 symbol 属性, 由于 ES5 中本来就不存在 symbols :</p> +<p>这个 <a href="/zh-CN/docs/Glossary/Polyfill">polyfill</a> 不支持 symbol 属性, 由于 ES5 中本来就不存在 symbols :</p> <pre class="notranslate">if (typeof Object.assign !== 'function') { // Must be writable: true, enumerable: false, configurable: true diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/allsettled/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/allsettled/index.html index 919da6e0b8..d552f10680 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/allsettled/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/allsettled/index.html @@ -59,11 +59,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise/allSettled <ul> <li> -<a href="https://wiki.developer.mozilla.org/zh-CN/docs/Archive/Add-ons/Techniques/Promises">Promises</a></li> +<a href="/zh-CN/docs/Archive/Add-ons/Techniques/Promises">Promises</a></li> <li> -<a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises">Using promises</a></li> +<a href="/zh-CN/docs/Web/JavaScript/Guide/Using_promises">Using promises</a></li> <li> -<a href="https://wiki.developer.mozilla.org/zh-CN/docs/Learn/JavaScript/Asynchronous/Promises">Graceful asynchronous programming with promises</a></li> +<a href="/zh-CN/docs/Learn/JavaScript/Asynchronous/Promises">Graceful asynchronous programming with promises</a></li> <li>{{jsxref("Promise")}}</li> <li>{{jsxref("Promise.all()")}}</li> </ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/reflect/index.html b/files/zh-cn/web/javascript/reference/global_objects/reflect/index.html index b35fe77d5c..4b430c4772 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/reflect/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/reflect/index.html @@ -10,13 +10,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Reflect --- <div>{{JSRef}}</div> -<p><strong>Reflect</strong> 是一个内置的对象,它提供拦截 JavaScript 操作的方法。这些方法与<a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler">proxy handlers</a>的方法相同。<code>Reflect</code>不是一个函数对象,因此它是不可构造的。</p> +<p><strong>Reflect</strong> 是一个内置的对象,它提供拦截 JavaScript 操作的方法。这些方法与<a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler">proxy handlers</a>的方法相同。<code>Reflect</code>不是一个函数对象,因此它是不可构造的。</p> <h2 id="描述">描述</h2> <p>与大多数全局对象不同<code>Reflect</code>并非一个构造函数,所以不能通过<a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/new">new运算符</a>对其进行调用,或者将<code>Reflect</code>对象作为一个函数来调用。<code>Reflect</code>的所有属性和方法都是静态的(就像{{jsxref("Math")}}对象)。</p> -<p><code>Reflect</code> 对象提供了以下静态方法,这些方法与<a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler">proxy handler methods</a>的命名相同.</p> +<p><code>Reflect</code> 对象提供了以下静态方法,这些方法与<a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler">proxy handler methods</a>的命名相同.</p> <p>其中的一些方法与 {{jsxref("Object")}}相同, 尽管二者之间存在 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/Comparing_Reflect_and_Object_methods">某些细微上的差别</a> .</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/regexp/index.html b/files/zh-cn/web/javascript/reference/global_objects/regexp/index.html index 27da890c46..2a1e6ffcf5 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/regexp/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/regexp/index.html @@ -200,7 +200,7 @@ console.log(regex.lastIndex); // prints "15" // and so on</pre> -<p><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes">Unicode属性转义特性</a>引入了一种解决方案,它允许使用像\p{scx=Cyrl}这样简单的语句。这里有一个外部资源,用来获取 Unicode 中的不同区块范围:<a href="http://kourge.net/projects/regexp-unicode-block" title="http://kourge.net/projects/regexp-unicode-block">Regexp-unicode-block</a></p> +<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes">Unicode属性转义特性</a>引入了一种解决方案,它允许使用像\p{scx=Cyrl}这样简单的语句。这里有一个外部资源,用来获取 Unicode 中的不同区块范围:<a href="http://kourge.net/projects/regexp-unicode-block" title="http://kourge.net/projects/regexp-unicode-block">Regexp-unicode-block</a></p> <h3 id="从_URL_中提取子域名">从 URL 中提取子域名</h3> diff --git a/files/zh-cn/web/javascript/reference/global_objects/set/index.html b/files/zh-cn/web/javascript/reference/global_objects/set/index.html index 49ede8bf54..3e8c53dc64 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/set/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/set/index.html @@ -26,7 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Set <h2 id="Constructor">Constructor</h2> <dl> - <dt><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/Set"><code>Set()</code></a></dt> + <dt><a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Set/Set"><code>Set()</code></a></dt> <dd>创建一个新的<code>Set</code>对象。</dd> </dl> diff --git a/files/zh-cn/web/javascript/reference/operators/inequality/index.html b/files/zh-cn/web/javascript/reference/operators/inequality/index.html index 867bda689f..dfa41522d1 100644 --- a/files/zh-cn/web/javascript/reference/operators/inequality/index.html +++ b/files/zh-cn/web/javascript/reference/operators/inequality/index.html @@ -22,19 +22,19 @@ translation_of: Web/JavaScript/Reference/Operators/Inequality <h2 id="描述"><font><font>描述</font></font></h2> -<p><font><font>不等式运算符检查其操作数是否不相等。</font><font>这是</font></font><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality"><font><font>等于</font></font></a><font><font>运算符</font><font>的取反,</font><font>因此以下两行将始终给出相同的结果:</font></font> </p> +<p><font><font>不等式运算符检查其操作数是否不相等。</font><font>这是</font></font><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Equality"><font><font>等于</font></font></a><font><font>运算符</font><font>的取反,</font><font>因此以下两行将始终给出相同的结果:</font></font> </p> <pre class="brush: js notranslate">x != y !(x == y)</pre> -<p><font><font>有关比较算法的详细信息,请参见</font></font><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality"><font><font>等于</font></font></a><font><font>运算符</font><font>的页面</font><font>。</font></font></p> +<p><font><font>有关比较算法的详细信息,请参见</font></font><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Equality"><font><font>等于</font></font></a><font><font>运算符</font><font>的页面</font><font>。</font></font></p> <p><font><font>与等于运算符一样,不等于运算符将尝试转换和比较不同类型的操作数:</font></font></p> <pre class="brush: js notranslate">3 != "3"; // false</pre> -<p><font><font>为避免这种情况,并要求将不同类型视为不同,请使用</font></font><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_inequality"><font><font>严格的不等于</font></font></a><font><font>运算符:</font></font></p> +<p><font><font>为避免这种情况,并要求将不同类型视为不同,请使用</font></font><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Strict_inequality"><font><font>严格的不等于</font></font></a><font><font>运算符:</font></font></p> <pre class="brush: js notranslate">3 !== "3"; // true</pre> @@ -94,9 +94,9 @@ object2 != object2 // false</pre> <h2 id="参见">参见</h2> <ul> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality">Equality operator</a></li> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality">Strict equality operator</a></li> - <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_inequality">Strict inequality operator</a></li> + <li><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Equality">Equality operator</a></li> + <li><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Strict_equality">Strict equality operator</a></li> + <li><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Strict_inequality">Strict inequality operator</a></li> </ul> <div id="gtx-trans" style="position: absolute; left: 16px; top: 1743.2px;"> diff --git a/files/zh-cn/web/javascript/reference/operators/optional_chaining/index.html b/files/zh-cn/web/javascript/reference/operators/optional_chaining/index.html index 2c91f70141..6f639f537a 100644 --- a/files/zh-cn/web/javascript/reference/operators/optional_chaining/index.html +++ b/files/zh-cn/web/javascript/reference/operators/optional_chaining/index.html @@ -16,7 +16,7 @@ original_slug: Web/JavaScript/Reference/Operators/可选链 --- <div>{{JSSidebar("Operators")}}</div> -<p><strong>可选链</strong>操作符( <strong><code>?.</code></strong> )允许读取位于连接对象链深处的属性的值,而不必明确验证链中的每个引用是否有效。<code>?.</code> 操作符的功能类似于 <code>.</code> 链式操作符,不同之处在于,在引用为空(<a href="https://wiki.developer.mozilla.org/en-US/docs/Glossary/nullish">nullish</a> ) ({{JSxRef("null")}} 或者 {{JSxRef("undefined")}}) 的情况下不会引起错误,该表达式短路返回值是 <code>undefined</code>。与函数调用一起使用时,如果给定的函数不存在,则返回 <code>undefined</code>。</p> +<p><strong>可选链</strong>操作符( <strong><code>?.</code></strong> )允许读取位于连接对象链深处的属性的值,而不必明确验证链中的每个引用是否有效。<code>?.</code> 操作符的功能类似于 <code>.</code> 链式操作符,不同之处在于,在引用为空(<a href="/zh-CN/docs/Glossary/nullish">nullish</a> ) ({{JSxRef("null")}} 或者 {{JSxRef("undefined")}}) 的情况下不会引起错误,该表达式短路返回值是 <code>undefined</code>。与函数调用一起使用时,如果给定的函数不存在,则返回 <code>undefined</code>。</p> <p>当尝试访问可能不存在的对象属性时,可选链操作符将会使表达式更短、更简明。在探索一个对象的内容时,如果不能确定哪些属性必定存在,可选链操作符也是很有帮助的。</p> 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 6ea1eb67c6..a53b49cb60 100644 --- a/files/zh-cn/web/javascript/reference/operators/this/index.html +++ b/files/zh-cn/web/javascript/reference/operators/this/index.html @@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Operators/this <p>与其他语言相比,<strong>函数的 <code>this</code> 关键字</strong>在 JavaScript 中的表现略有不同,此外,在<a href="/zh-CN/docs/Web/JavaScript/Reference/Strict_mode">严格模式</a>和非严格模式之间也会有一些差别。</p> -<p>在绝大多数情况下,函数的调用方式决定了 <code>this</code> 的值(运行时绑定)。<code>this</code> 不能在执行期间被赋值,并且在每次函数被调用时 <code>this</code> 的值也可能会不同。ES5 引入了 <a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/bind">bind</a> 方法来设置函数的 <code>this</code> 值,而不用考虑函数如何被调用的。ES2015 引入了<a href="https://wiki.developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭头函数</a>,箭头函数不提供自身的 this 绑定(<code>this</code> 的值将保持为闭合词法上下文的值)。</p> +<p>在绝大多数情况下,函数的调用方式决定了 <code>this</code> 的值(运行时绑定)。<code>this</code> 不能在执行期间被赋值,并且在每次函数被调用时 <code>this</code> 的值也可能会不同。ES5 引入了 <a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/bind">bind</a> 方法来设置函数的 <code>this</code> 值,而不用考虑函数如何被调用的。ES2015 引入了<a href="/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭头函数</a>,箭头函数不提供自身的 this 绑定(<code>this</code> 的值将保持为闭合词法上下文的值)。</p> <p>{{EmbedInteractiveExample("pages/js/expressions-this.html")}}</p> 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 fabebc11d1..b7634d9cef 100644 --- a/files/zh-cn/web/javascript/reference/statements/import/index.html +++ b/files/zh-cn/web/javascript/reference/statements/import/index.html @@ -136,7 +136,7 @@ var promise = import("module-name");//这是一个处于第三阶段的提案。 <li>当被导入的模块有副作用(这里说的副作用,可以理解为模块中会直接运行的代码),这些副作用只有在触发了某些条件才被需要时。(原则上来说,模块不能有副作用,但是很多时候,你无法控制你所依赖的模块的内容)</li> </ul> -<p>请不要滥用动态导入(只有在必要情况下采用)。静态框架能更好的初始化依赖,而且更有利于静态分析工具和<a href="https://wiki.developer.mozilla.org/en-US/docs/Glossary/Tree_shaking">tree shaking</a>发挥作用</p> +<p>请不要滥用动态导入(只有在必要情况下采用)。静态框架能更好的初始化依赖,而且更有利于静态分析工具和<a href="/zh-CN/docs/Glossary/Tree_shaking">tree shaking</a>发挥作用</p> <p>关键字import可以像调用函数一样来动态的导入模块。以这种方式调用,将返回一个 <code>promise</code>。</p> |