function count(arr, item) {
    let str = 0;
    for (let i = 0; i < arr.length; i++) {
        if (arr[i] == item){
            ++str;
        }
    }
    return str;
}
var items = count([1, 2, 4, 4, 3, 4, 3], 4);
console.log(items);