diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/array/some/index.html | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html index 734cace600..426e6b16a6 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html @@ -78,8 +78,6 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/some <pre class="brush: js"><code>[2, 5, 8, 1, 4].some(x => x > 10); // false [12, 5, 8, 1, 4].some(x => x > 10); // true</code></pre> -<p>{{ EmbedLiveSample('Testing_array_elements_using_arrow_functions', '', '', '', 'Web/JavaScript/Reference/Global_Objects/Array/some') }}</p> - <h3 id="判断数组元素中是否存在某个值">判断数组元素中是否存在某个值</h3> <p>此例中为模仿 <code>includes()</code> 方法, 若元素在数组中存在, 则回调函数返回值为 <code>true</code> :</p> @@ -95,8 +93,6 @@ function checkAvailability(arr, val) { checkAvailability(fruits, 'kela'); // false checkAvailability(fruits, 'banana'); // true</pre> -<p>{{ EmbedLiveSample('Checking_whether_a_value_exists_in_an_array', '', '', '', 'Web/JavaScript/Reference/Global_Objects/Array/some') }}</p> - <h3 id="使用箭头函数判断数组元素中是否存在某个值">使用箭头函数判断数组元素中是否存在某个值</h3> <pre class="brush: js">var fruits = ['apple', 'banana', 'mango', 'guava']; @@ -108,9 +104,6 @@ function checkAvailability(arr, val) { checkAvailability(fruits, 'kela'); // false checkAvailability(fruits, 'banana'); // true</pre> -<p>{{ EmbedLiveSample('Checking_whether_a_value_exists_using_an_arrow_function', '', '', '', 'Experiment:StaticExamplesOnTop/JavaScript/Array/some') }}</p> - - <h3 id="将任意值转换为布尔类型">将任意值转换为布尔类型</h3> @@ -134,8 +127,6 @@ getBoolean(1); // true getBoolean('true'); // true </pre> -<p>{{ EmbedLiveSample('Converting_any_value_to_Boolean', '', '', '', 'Web/JavaScript/Reference/Global_Objects/Array/some') }}</p> - <h2 id="Compatibility" name="Compatibility">Polyfill</h2> <p>在第 5 版时,<code>some()</code> 被添加进 ECMA-262 标准;这样导致某些实现环境可能不支持它。你可以把下面的代码插入到脚本的开头来解决此问题,从而允许在那些没有原生支持它的实现环境中使用它。该算法是 ECMA-262 第 5 版中指定的算法,假定 <code>Object </code>和 <code>TypeError</code> 拥有他们的初始值,且 <code>fun.call</code> 等价于 <code>{{jsxref("Function.prototype.call")}}</code>。</p> |