Array.reduce

爽就完事儿了

function count(arr, item) {
    return arr.reduce((count, curr) => count += Number(curr === item), 0)
}