SHARE
TWEET

Length Of Array

bappy7706 May 27th, 2020 787 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var grd=[2,4,6,8,10];
  2. var sm=0;
  3. var count =0;
  4. if(grd.length>0)
  5.   {
  6.     for(index=0;index<grd.length;index++)
  7.       if (grd[index]!=undefined){
  8.          sm += grd[index];
  9.     count =count+1;
  10.       }
  11.   }
  12.  
  13. document.write(sm/count);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top