With Javascript use a for loop to sum numbers in an array
<p>I'm trying to find a way to sum all the numbers that have been added to an array. I believe this should work:</p>

<pre><code>   var total = 0;

   for (var i  = 0; i &lt; totalPrice.length; i++);

   total  += totalPrice[i];
   document.getElementById("displayPrice").innerHTML = total;
</code></pre>

<p>But total comes out as a NaN.</p>

<p>This is an example of my code in JSFiddle, if you add the item twice the value gets pushed into the array, what am I doing wrong with the for loop?</p>

<p><a href="https://jsfiddle.net/bgv5s9re/2/" rel="nofollow">https://jsfiddle.net/bgv5s9re/2/</a></p>