You are viewing a single comment's thread. Return to all comments →
JavaScript Solution
function plusMinus(arr) { let [pos, neg, zer] = [0,0,0]; for(let i = 0; i < arr.length; i++){ if(arr[i] > 0)pos++; else if(arr[i] < 0)neg++; else if(arr[i] === 0) zer++; } let ratios = [pos, neg, zer]; ratios.forEach(val => { console.log((val/arr.length).toFixed(6)); }) }
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 →
JavaScript Solution