The Javascript BigUint64Array indexOf()
method returns the first index for a given element, or -1 if it is not present.
This method works the same as Array.prototype.indexOf()
.
BigUint64Array.indexOf(searchElement[, fromIndex = 0])
Parameter | Optional | Meaning |
---|---|---|
searchElement | Required | Element to find in the typed array. |
fromIndex | Optional | The index to start the search at. |
If the fromIndex
is greater than or equal to the typed array's length, -1 is returned.
If the fromIndex
is a negative number, it is array.length+ fromIndex
.
indexOf()
uses strict equality (=== operator).
var uint8 = new BigUint64Array([2n, 5n, 9n]); let a = uint8.indexOf(2); console.log(a);//from w w w . ja v a2 s .c o m a = uint8.indexOf(7); console.log(a); a = uint8.indexOf(9, 2); console.log(a); a = uint8.indexOf(2, -1); console.log(a); a = uint8.indexOf(2, -3); console.log(a);