You are viewing a single comment's thread. Return to all comments →
let positive =0, negative=0, zero = 0 let finalArr = [] arr.map((n,i) =>{ if(n>0) positive++ if(n<0) negative++ if(n===0) zero++ }) finalArr[0] = (positive / arr.length).toFixed(6) finalArr[1] = (negative / arr.length).toFixed(6) finalArr[2] = (zero / arr.length).toFixed(6) console.log(finalArr.join("\n"))
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →