Whats wrong with this piece of code?
<p>Trying to figure out what's wrong with this piece of code.     </p>

<pre><code> //Code to return the sum of all values in an array
 var x = [ 1,2,3,4,5 ]; 

 //Function to return sum of values in an array
 function sum(arr) {

   var sum = 0;

   for (i=1; i &lt; arr.length; i++) {
     sum = sum + x[i];
   }

   return sum;
 }
</code></pre>

<p>What will be the value of <code>sum(x)</code>?</p>