title: JS calculator issue. Wrong Answer
body: <p>I'm writing a one-line calculator, that has the basic functions (+ - * /). I have done this before, but now I keep getting wrong answers, and I can't find my mistake. Here is my code:</p>
  
  <pre><code>var seq = document.getElementById('sequence').value;
  var allNums = [];
  var i = 0, allSigns = [];
  var currentNums = "";
  
  for (i = 0; i&lt; seq.length; i++)
  {
      if (seq[i] != "+" &amp;&amp; seq[i] != "-" &amp;&amp; seq[i] != "*" &amp;&amp; seq[i] != "/")
      {
          currentNums+=seq[i];
      }
      else
      {
          allNums.push(Number(currentNums));
          currentNums="";
          allSigns.push(seq[i]);
      }
  }
  allNums.push(Number(currentNums));
  var result = 0;
  for (i = 0; i &lt; allNums.length; i++)
  {
      if (allSigns[i] == '+')
          result+=Number(allNums[i]);
      else if (allSigns[i] == "-")
          result-=Number(allNums[i]);
      else if (allSigns[i] == "*")
          result*=Number(allNums[i]);
      else if (allSigns[i] == "/")
          result/=parseInt(allNums[i]);
      else
      {
          alert("The result is: " + result);
          break;
      }
  }
  </code></pre>
  
  <p>All of this code is in a function, called calculate. The func is triggered by a button, and the sequence comes from an input. </p>