谢楼主题目,没看懂ts这题,第三题 function getCountAndIndex(arr, target) { let map = new Map() for (let c of arr) { map.set(c, map.has(c) ? map.get(c) + 1 : 1) } return arr.indexOf(target) > -1 ? [map.get(target), arr.indexOf(target)] : [0, -1] }