Writing a program to add all the odd numbers in an array
<pre><code> // Write a program to sum all the odd elements of an array

    a = Number(prompt("a:"));
    b = Number(prompt("b:"));
    c = Number(prompt("c:"));

    sum=Number(0);

    var test = [a,b,c];

    for (i=0; i&lt;test.length;i++) {
        // All even numbers can be divided by 2
        if ((test[i]%2)&gt;0) {
            alert(test[i] + ":odd");
        } else {
            alert(test[i] + ":even");
        }
        test[i]=0;
   }

   sum=0+test[i];
   alert(sum);
</code></pre>

<p>My program works brilliant up until its meant to add up all the numbers where it returns a NaN message! Any ideas on how I can sort this problem out?</p>
