title: Sum of a string of one-digit numbers in javascript?
body: <p>I'm trying to write a script that adds the left side of a string and validates it against the right side.</p>
  
  <p>For example:</p>
  
  <pre><code>var left = "12345"
  var right = "34567"
  </code></pre>
  
  <p>I need to do some sort of sum function that adds 1+2+3+4+5 and checks if it equals 3+4+5+6+7.</p>
  
  <p>I just don't have a clue how to do it.</p>
  
  <p>I think I need to use a for loop to iterate through the numbers such as
  for (var i = 0, length = left.length; i &lt; length; i++)</p>
  
  <p>But I'm not sure how to add each number from there.</p>
  
  <p><em><strong>EDIT</em></strong> the var is actually being pulled in from a field. so var left = document.blah.blah</p>