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