diff options
author | WooMai <allentian666@gmail.com> | 2021-10-14 01:52:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-14 01:52:24 +0800 |
commit | 2a5aa35d0b8acedf6f14bc0fef69d141efd605a9 (patch) | |
tree | 2614edea6b21a999e9e8b7ee62e721302c10806e /files/zh-cn/web/javascript/reference/global_objects | |
parent | 5fc8361c0487b4db07bc68437a6a0f6c5fa28d10 (diff) | |
download | translated-content-2a5aa35d0b8acedf6f14bc0fef69d141efd605a9.tar.gz translated-content-2a5aa35d0b8acedf6f14bc0fef69d141efd605a9.tar.bz2 translated-content-2a5aa35d0b8acedf6f14bc0fef69d141efd605a9.zip |
Improve Simplified Chinese Translation (#2714)
* Improve Chinese Translations
* remove residual english parts
* remove line break
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html index 183d9978b3..5001b155be 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/includes --- <div>{{JSRef}} </div> -<p><code><strong>includes()</strong></code> 方法用来判断一个数组是否包含一个指定的值,根据情况,如果包含则返回 true,否则返回false。</p> +<p><code><strong>includes()</strong></code> 方法用来判断一个数组是否包含一个指定的值,根据情况,如果包含则返回 <code>true</code>,否则返回 <code>false</code>。</p> <div>{{EmbedInteractiveExample("pages/js/array-includes.html")}}</div> @@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/includes <p>需要查找的元素值。</p> <div class="blockIndicator note"> - <p><strong>Note: </strong>使用<strong> </strong><code>includes()</code>比较字符串和字符时是区分大小写。</p> + <p><strong>Note: </strong>使用<strong> </strong><code>includes()</code>比较字符串和字符时是区分大小写的。</p> </div> </dd> <dt><code>fromIndex</code> {{optional_inline}}</dt> @@ -38,12 +38,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/includes <h3 id="返回值">返回值</h3> -<p>A {{jsxref("Boolean")}} which is <code>true</code> if the value <code>valueToFind</code> is found within the array (or the part of the array indicated by the index <code>fromIndex</code>, if specified). Values of zero are all considered to be equal regardless of sign (that is, -0 is considered to be equal to both 0 and +0), but <code>false</code> is not considered to be the same as 0.</p> +<p>返回一个布尔值 {{jsxref("Boolean")}} 。<br>]如果在数组中(或 <code>fromIndex</code> 指定的范围中)找到了 <code>valueToFind</code>,则返回 <code>true</code>,否则返回 <code>false</code>。</p> -<p>返回一个布尔值 {{jsxref("Boolean")}} ,如果在数组中找到了(如果传入了 <code>fromIndex</code> ,表示在 <code>fromIndex</code> 指定的索引范围中找到了)则返回 <code>true</code> 。</p> +<p>0 的值将全部视为相等,与符号无关(即 -0 与 0 和 +0 相等),但 <code>false</code> 不被认为与 0 相等。</p> <div class="note"> -<p><strong>Note:</strong> Technically speaking, <code>includes()</code> uses the <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality">sameValueZero</a></code> algorithm to determine whether the given element is found.</p> +<p><strong>Note:</strong> 技术上来讲,<code>includes()</code> 使用 <code><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Equality_comparisons_and_sameness#%E9%9B%B6%E5%80%BC%E7%9B%B8%E7%AD%89">零值相等</a></code> 算法来确定是否找到给定的元素。</p> </div> <h2 id="示例">示例</h2> @@ -57,7 +57,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/includes <h3 id="fromIndex_大于等于数组长度">fromIndex 大于等于数组长度</h3> -<p>如果 <code>fromIndex</code> 大于等于数组的长度,则会返回 <code>false</code>,且该数组不会被搜索。</p> +<p>如果 <code>fromIndex</code> 大于等于数组的长度,则将直接返回 <code>false</code>,且不搜索该数组。</p> <pre class="brush: js">var arr = ['a', 'b', 'c']; @@ -66,7 +66,7 @@ arr.includes('c', 100); // false</pre> <h3 id="计算出的索引小于_0">计算出的索引小于 0</h3> -<p>如果 <code>fromIndex </code>为负值,计算出的索引将作为开始搜索<code>searchElement</code>的位置。如果计算出的索引小于 0,则整个数组都会被搜索。</p> +<p>如果 <code>fromIndex</code> 为负值,计算出的索引将作为开始搜索<code>searchElement</code>的位置。如果计算出的索引小于 0,则整个数组都会被搜索。</p> <pre class="brush: js">// array length is 3 // fromIndex is -100 |