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

String.prototype.count(callback)

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

let str = "asdfasdfaaa";
console.log(str.count((e) => e == "a")); //5