includes() method of
TypedArray instances determines whether a typed array includes a certain value among its entries, returning
false as appropriate. This method has the same algorithm as
includes(searchElement) includes(searchElement, fromIndex)
The value to search for.
Zero-based index at which to start searching, converted to an integer.
A boolean value which is
true if the value
searchElement is found within the typed array (or the part of the typed array indicated by the index
fromIndex, if specified).
Array.prototype.includes() for more details. This method is not generic and can only be called on typed array instances.
const 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;
|ECMAScript Language Specification |
BCD tables only load in the browser