title: Ignore NaN when adding input values in JavaScript
body: <p>I have the following code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var inputsArray = document.getElementsByTagName('input');
  
  function computeTotal() {
    var tot = 0;
    tot += parseFloat(inputsArray[0].value);
    tot += parseFloat(inputsArray[1].value);
    tot += parseFloat(inputsArray[2].value);
    inputsArray[3].value = tot;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="text"&gt;&lt;/input&gt;
  &lt;input type="text"&gt;&lt;/input&gt;
  &lt;input type="text"&gt;&lt;/input&gt;
  &lt;input type="text" disabled&gt;&lt;/input&gt;
  &lt;button type="button" onclick="computeTotal()"&gt;Calculate&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>It calculates fine when a number is entered in all three boxes, but I would like it to calculate even if a box is left empty, when in fact returns NaN.</p>
  <p>P.S.: I know I could use a &quot;for&quot; loop and the isNaN() method to skip blank inputs, but I'm really looking for a solution for adding the inputs one by one.</p>
  <p>I do not want to convert the NaN to 0.</p>