const _findMostType = (array) => { // 补全代码 let typaArr = []; array.forEach((item, index) => { let currentType = typeof item; console.log(currentType); typaArr.push(currentType); }); const countObj = typaArr.reduce((obj, newvalue) => { if (newvalue in obj) { obj[newvalue]++; } else { obj[newvalue] = 1; } return obj; }, {}); let max = 0; let arr = []; for (let i in countObj) { if (countObj[i] > max) { max = countObj[i]; arr = [i]; } else if (countObj[i] === max) { arr.push(i); } } if(arr.length>0){ arr.push(countObj[arr[0]]) } return arr };