Skip to content

Search / Check Methods

Checks if value exists.

arr.includes(20);

Time: O(n) Mutates? No


Returns first index of value.

arr.indexOf(30);

Time: O(n)


Returns first matching element.

.find(u => u.id === 1);
```e:** O(n)
---
<a id="findindex"></a>
## findIndex()
Returns index of first match.
```javascript
users.findIndex(u => u.id === 1);

Time: O(n)


Returns true if any element matches.

arr.some(n => n > 10);

Time: O(n)


Returns true if all elements match.

arr.every(n => n > 0);

Time: O(n)