title: Sorting out numbers in for loops
body: <p>So I am determining which is a prime number and which isn't, but I am just not understanding how it ends up with the correct output.</p>
  
  <p>So the first starts at 2 and loops by 1 to 100. Easy.
  But the second starts at 0, and loops by y + itself, this would make sense, but in determining the primes, it should mess up, atleast I thought
  it's like: 1+3 = 4 or 2 + 4 = 6 or 3 + 5 = 8</p>
  
  <p>and that works, but what happens to let's say the 15? that isn't a prime number.
  How is numbers like that sorted in the loop?</p>
  
  <pre><code>var prim = [];
   var notprim = [];
    for(var x = 2; x &lt;= 100; x++){
      if(!notprim[x]){
          prim.push(x);
  
  
          for(var y = 0; y &lt;= 100; y = y+x){
              notprim[y] = true;
              document.write(y);
          }
      }
     }
  </code></pre>