题解 | #计数#
计数
https://www.nowcoder.com/practice/628339bd8e6e440590ad86caa7ac6849
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);