title: For loop not iterating through array (JavaScript)
body: <p>I am adding up the values in array by iterating through the array with a for-loop but it is only returning the first value. I am alerted 2 instead of 2014 like expected.</p>
  
  <p>What am I doing wrong?</p>
  
  <p><a href="http://Fiddle" rel="nofollow">enter link description here</a></p>
  
  <p>JavaScript</p>
  
  <pre><code>$(document).ready(function() {
      var array = [2, 2, 10, 0, 50, 1900, 25, 25];
      function arraySum(arr) {
          var answer = 0;
          for (i = 0; i &lt; array.length; i++) {
              answer += array[i];
              return answer;
          }
      }
      var response = arraySum(array);
      alert(response);
  });
  </code></pre>