const arr = [29.63, 27.37, 28.31, 27.3, 33.45, 27.10, 29.07] function dealData () { const a = arr arr.forEach(items => { a.forEach(abc => { let c = items + abc c = dealDatas(Number(c), 2) if (c == 60.55) { console.log('items', items) console.log('abc', abc) } }) }) } /** * 处理浮点数 */ function dealDatas (conates, index) { let newArr = '' const result = conates.toString().substring(0, conates.toString().indexOf('.') + (index + 1)) newArr = parseFloat(result) return newArr } dealData()