How to use TypedArray.includes() to determines whether a typed array include a certain element in JavaScript

1 Answer

0 votes
// typedarray.includes(searchElement[, fromIndex]);

var arr = new Uint8Array([10, 7, 13, 14, 31, 100]);

document.write(arr.includes(8) + "<br />");
document.write(arr.includes(7) + "<br />");

/*
run:

false
true

*/

 



answered Aug 13, 2016 by avibootz
...