📅  最后修改于: 2022-03-11 15:01:13.886000             🧑  作者: Mango
function plusMinus(arr) {
let min = []
let plus = []
let zero = []
arr.forEach((val) => {
if(val < 0) {
min.push(val)
}
if(val > 0) {
plus.push(val)
}
if(val == 0) {
zero.push(val)
}
})
plus = Math.abs(plus.length / arr.length).toFixed(6)
min = Math.abs(min.length / arr.length).toFixed(6)
zero = Math.abs(zero.length / arr.length).toFixed(6)
console.log(plus)
console.log(min)
console.log(zero)
}