Determines whether any of the elements of an iterable pass a given predicate.
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
true if any element passes the predicate, false otherwise
true
false
Iterable
some([false], x => x); // false Copy
some([false], x => x); // false
some([false, true], x => x); // true Copy
some([false, true], x => x); // true
some([true], x => x); // true Copy
some([true], x => x); // true
Determines whether any of the elements of an iterable pass a given predicate.
Time complexity: O(n)
Space complexity: O(1)