Counts the number of items that satisfy a predicate in the given iterable or asynchronous iterable.
const countOdds = count((number: number) => number % 2 !== 1);countOdds([1, 2, 3, 4, 5]); // 3countOdds([0, 2, 4, 6, 8]); // 0 Copy
const countOdds = count((number: number) => number % 2 !== 1);countOdds([1, 2, 3, 4, 5]); // 3countOdds([0, 2, 4, 6, 8]); // 0
Predicate function for items to be counted.
Curried function with predicate in context.
predicate
Counts the number of items that satisfy a predicate in the given iterable or asynchronous iterable.
Example