Calculating inner product of an array
<pre><code>// Write a program to calculate the innerproduct of two arrays (ip of v,w = sum, for all i, of vi*wi)

var v = [1, 2, 3, 'x'];
var w = [1, 2, 3, 4];
vSum_total = 0;
wSum_total = 0;

// calculate sum of v
for(i=0; i&lt;v.length; i++)
{
    if (isNaN(v[i]))
    v[i] = 0
    else
    vSum_total += Number(v[i]);
}

// calculate sum of w
for(i=0; i&lt;v.length; i++)
{
    if (isNaN(v[i]))
    v[i] = 0
    else
    wSum_total += Number(w[i]);
}

alert ("Total of v: " + (vSum_total));
alert ("Total of w: " + (wSum_total));
alert ("Inner product: " + (vSum_total * wSum_total));
</code></pre>

<p>I'm trying to calculate the inner product of an array but my result isn't alerting. Any hints in the right direction would be really appreciated!</p>
