title: For Loop repeats first loop twice
body: <p>I have this for loop, and it seems to be repeating the first loop twice (x=0) and then not doing the last one (x=2)</p>
  
  <pre><code>for (x=0;x&lt;=2;x++)
      {
          if (document.getElementById("sub"+catCount+x).value != "")
          {
              if (nonums.test(document.getElementById("sub"+catCount+x).value))
              {
                  total = total + parseFloat(document.getElementById("sub"+catCount+x).value);
              }
          }
          alert(x);
      }
  </code></pre>
  
  <p>In other words, I get two alert boxes with "0" in them, then one with "1" in it, and that's it.</p>
  
  <p>Can anyone tell me what I'm not seeing here? Why doesn't it just progress through the loop normally (0,1,2)?</p>