not giving sum of the row
<p>I am getting undefined as the resulting sum of the row.</p>

<pre><code>var myArray = new Array(3);

for (var i = 0; i &lt; 3; i++) {
    myArray[i] = new Array(3);
    for (var j = 0; j &lt; 3; j++) {
        myArray[i][j]=prompt("element"," ");
    }
}
for(i=0;i&lt;4;i++)
{ 
    sum=0;
    for(j=0;j&lt;4;j++)
    {
        document.write(myArray[i][j]);
        sum+=myArray[i][j];
    }
    document.write("sum of"+ i+ "row"+sum);
}
</code></pre>
