Skip to content

Latest commit

 

History

History
9 lines (7 loc) · 246 Bytes

count.md

File metadata and controls

9 lines (7 loc) · 246 Bytes

Array.prototype.count(callback)

Returns the number of elements for which the callback function returns true. The callback function receives each element in order.

let arr = [1, 3, 5, 3, 2];
console.log(arr.count((e) => e == 3)); // 2