You are viewing a single comment's thread. Return to all comments →
This is a simple javaScript logic to solve this question if(arr.length===0){ return 0; }else{ for(let i=0; i<=arr.length;i++){
if(arr[i]>0){ a1=a1+1; }else if(arr[i]<0){ b1=b1+1; }else if(arr[i]===0){ c1=c1+1; }else{ } console.log(a1/arr.length); console.log(b1/arr.length); console.log(c1/arr.length); }
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 →
This is a simple javaScript logic to solve this question if(arr.length===0){ return 0; }else{ for(let i=0; i<=arr.length;i++){