This article is in need of an editorial review.
This translation is incomplete. Please help translate this article from English.
This is an experimental technology, part of the Harmony (ECMAScript 7) proposal.
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future version of browsers as the spec changes.
概要
typed arrayがある要素を含むかどうか判断し、応じて、trueかfalseを返します。このメソッドはArray.prototype.includes()と同じアルゴリズムを持ちます。TypedArrayはここではtyped array types の一つです。
構文
typedarray.includes(searchElement[, fromIndex]);
引数
searchElement- 探す対象の要素
fromIndex- オプション。
searchElementを探し始める配列内の位置。デフォルトでは0です。
例
var uint8 = new Uint8Array([1,2,3]); uint8.includes(2); // true uint8.includes(4); // false uint8.includes(3, 3); // false // NaN handling (only true for Float32 and Float64) new Uint8Array([NaN]).includes(NaN); // false, since the NaN passed to the constructor gets converted to 0 new Float32Array([NaN]).includes(NaN); // true; new Float64Array([NaN]).includes(NaN); // true;
仕様
ES7 提案中: https://github.com/tc39/Array.prototype.includes.
ブラウザ実装状況
| 機能 | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| 基本サポート | 未サポート | Available in Nightly channel only (since 2014-12-27) | 未サポート | 未サポート | 未サポート |
| 機能 | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| 基本サポート | 未サポート | 未サポート | Available in Nightly channel only (since 2014-12-27) | 未サポート | 未サポート | 未サポート |