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