API Reference

Returns the number of instances the target occurs in an array

function count<T>(arr: T[], target: T): number

// Example:

const arr = [1, 2, 3, 3, 4, 4, 4, 5]

count(arr, 4) //=> 3