function count(arr, item) { let num = 0; for(let i = 0;i<arr.length;i++){ if(arr[i] == item){ num++ } } return num }
注意:return num要放在for循环之外