Count number of value appearance in array
1 const numOfAppearances = (array, value) => {
2 return array.reduce((acc, currVal) => currVal === value ? ++acc : acc, 0);
3 };
4
5 const count = numOfAppearances(['one', 'yes', 3, 'yes', false], 'yes'); // 2