title: Which function would you use - Javascript
body: <p>I'm new to <code>javascript</code> and I have the following code:</p>
  
  <pre><code>&lt;p id="demo"&gt;&lt;/p&gt;
  
  &lt;script&gt;
      var text = "";
      var x = 1;
      var y = 1;
      while(x &lt; 9) {
         text += "&lt;br&gt;" + x +"," + y;
         x++;
      }
      document.getElementById("demo").innerHTML = text;
  &lt;/script&gt;
  </code></pre>
  
  <p>It prints out a list of <code>coordinates</code>:</p>
  
  <pre><code>1,1
  2,1
  3,1
  4,1
  5,1
  6,1
  7,1
  8,1
  </code></pre>
  
  <p>The question is once it gets to 8,1 What would you use to get it to continue to:</p>
  
  <pre><code>1,2
  2,2
  3,2
  4,2
  5,2
  6,2
  7,2
  8,2
  </code></pre>
  
  <p>then
      1,3
      and so on until it reaches 3,4 (this could be variable) then it stops.</p>
  
  <p>In an ideal world I would be able to get it to go up to a maximum of 8,12. </p>