Search / Check Methods
Search / Check Methods
Section titled “Search / Check Methods”includes()
Section titled “includes()”Checks if value exists.
arr.includes(20);Time: O(n) Mutates? No
indexOf()
Section titled “indexOf()”Returns first index of value.
arr.indexOf(30);Time: O(n)
find()
Section titled “find()”Returns first matching element.
.find(u => u.id === 1);```e:** O(n)
---
<a id="findindex"></a>## findIndex()
Returns index of first match.
```javascriptusers.findIndex(u => u.id === 1);Time: O(n)
some()
Section titled “some()”Returns true if any element matches.
arr.some(n => n > 10);Time: O(n)
every()
Section titled “every()”Returns true if all elements match.
arr.every(n => n > 0);Time: O(n)