includes()
method determines whether a typed array includes a certain element, returning
true
or
false
as appropriate. This method has the same algorithm as
Array.prototype.includes()
.
TypedArray
is one of the
typed array types
here.
typedarray.includes(searchElement[, fromIndex]);
searchElement
The element to search for.
fromIndex
searchElement
; defaults to 0.
A
布尔
.
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;
| 规范 |
|---|
|
ECMAScript (ECMA-262)
The definition of 'TypedArray.prototype.includes' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
includes
|
Chrome 47 | Edge 14 | Firefox 43 | IE No | Opera 34 | Safari 10 | WebView Android No | Chrome Android 47 | Firefox Android 43 | Opera Android 34 | Safari iOS 10 | Samsung Internet Android 5.0 |
nodejs
6.0.0
|
完整支持
不支持
用户必须明确启用此特征。
TypedArray
TypedArray.from()
TypedArray.of()
TypedArray.prototype.copyWithin()
TypedArray.prototype.entries()
TypedArray.prototype.every()
TypedArray.prototype.fill()
TypedArray.prototype.filter()
TypedArray.prototype.find()
TypedArray.prototype.findIndex()
TypedArray.prototype.forEach()
TypedArray.prototype.includes()
TypedArray.prototype.indexOf()
TypedArray.prototype.join()
TypedArray.prototype.keys()
TypedArray.prototype.lastIndexOf()
TypedArray.prototype.map()
TypedArray.prototype.reduce()
TypedArray.prototype.reduceRight()
TypedArray.prototype.reverse()
TypedArray.prototype.set()
TypedArray.prototype.slice()
TypedArray.prototype.some()
TypedArray.prototype.sort()
TypedArray.prototype.subarray()
TypedArray.prototype.toLocaleString()
TypedArray.prototype.toString()
TypedArray.prototype.values()
TypedArray.prototype[@@iterator]()
Int8Array
Uint8Array
Uint8ClampedArray
Int16Array
Uint16Array
Int32Array
Uint32Array
Float32Array
Float64Array
BigInt64Array
BigUint64Array
Function
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()