Let’s say we have an array of numbers in JavaScript that looks like this: let array = [1, 2, 3, 5, 2, 8, 9, 2]; and we want to count the number of 2’s in the array. A quick and direct way to get the count of 2’s would be to do something like this: … Continue reading JavaScript: How to find the count of an element in an array using filter( )