题解 | #高频数据类型#
高频数据类型
https://www.nowcoder.com/practice/687425f78096428baa58fbdcf024244a
const _findMostType = array => { // 补全代码 let tem = {} let arr = [] let num = 0 for(let key of array) { const type = typeof key tem[type] = (tem[type] || 0) + 1 num = Math.max(num, tem[type]) } for (let key in tem) { if(tem[key] === num) { arr.push(key) } } return [...arr, num] }