# countOccurrences
Useimport { countOccurrences } from 'util-snippets'
/**
* Example:countOccurrences([1, 1, 2, 1, 2, 3], 1); // 3
*/
countOccurrences(array,element)
const countOccurrences = (arr: [], val): number =>
arr.reduce((a, v) => (v === val ? a + 1 : a), 0);
← debounce difference →