Category
Returns the value of the first element in the iterable where predicate is truthy, and undefined otherwise.
predicate
undefined
Time complexity: O(n)
Space complexity: O(1)
The iterable to take elements from
The function to call on each element in the iterable to determine if it passes the test
The value of the first element in the iterable where predicate is truthy, and undefined otherwise
Iterable
find([1, 2, 3], x => x === 2); // 2 Copy
find([1, 2, 3], x => x === 2); // 2
Returns the value of the first element in the iterable where
predicate
is truthy, andundefined
otherwise.Time complexity: O(n)
Space complexity: O(1)