title: Calculate Average in JavaScript when there is missing value
body: <p>I have a row of 10 cells in which user enters the value.
  I need to calculate the average of only those cells which has value and ignore the cells without value.
  I take the input using document.getElementById(&quot;demo&quot;).value and then insert it in an array.
  In case of missing value it is inserting 0 in the array which I don't want.</p>
  <pre><code>var calcvalue = new array();
  for(i = 0; i&lt;10; i++){
     var getObj = document.getElementById('demo'+ i);
     if(getObj.value != ''){
        calcvalue.push(getObj.value);
        break;
    }
  }
  
  </code></pre>
  <p>How can I ignore the cells which don't have any value.</p>