Counts all elements or elements satisfying a predicate in haystack.
The first overload counts each element e in haystack for which pred(e) is true. Performs O(haystack.length) evaluations of pred.
The second overload counts the number of elements in a range.
If the given range has the length property,
that is returned right away, otherwise
performs O(haystack.length) to walk the range.
Counts all elements or elements satisfying a predicate in haystack.
The first overload counts each element e in haystack for which pred(e) is true. Performs O(haystack.length) evaluations of pred.
The second overload counts the number of elements in a range. If the given range has the length property, that is returned right away, otherwise performs O(haystack.length) to walk the range.