Does it mutate 😱
Array.prototype.find
No mutation
Description
The find()
method of Array
instances returns the first element in the provided array that satisfies the provided testing function.
If no values satisfy the testing function, undefined
is returned.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
Example
const array1 = [5, 12, 8, 130, 44];
const found = array1.find((element) => element > 10);
console.log(found);
// Expected output: 12