Calculate Array values using For-In Loop
<p>I have the following Javascript. I am trying to calculate the total of the myCosts array values using the 'for in; loop and then display them on the page. I think i am nearly there.</p>

<pre><code>function enterFood() 
{ 
    var myFoods = new Array() 
    var myCosts = new Array() 

    for (i = 1; i &lt;= 5; i++) 
    { 
        myFoods[i] = prompt("Enter name of Food",""); 
        myCosts[i] = parseFloat(prompt("Enter cost of food","")); 
        document.getElementById("cost").innerHTML += i + ". " + myFoods[i] + ". Cost: £" + myCosts[i] + "&lt;br /&gt;"; 
    } 

    for (var i in myCosts) 
    { 
        document.getElementById("total_cost").innerHTML =+ i; 
    } 
}  
</code></pre>

<p>Can anybody offer any help so I can complete this?</p>
