Count specific values in array

Return number of values val in array arr.

console.log(count([1, 2, 1, 5, 1], 1)) // 3
console.log(count([], 1)) // 0
var obj = {}
console.log(count([{}, obj], obj)) // 1