title: Why is my javascript code going into an infinite loop?
body: <p>In the code below, whenever I click on the submit button, multiple window's open up as it it were in infinite loop. If I uncomment alert, then multiple alerts keep popping like they were in infinite loop. Why could this be happening ?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;script type = "text/javascript"&gt;
      var window;
  
      function moveBy() {
          //alert("-- hello ---");
          window = window.open("http://www.w3schools.com");
          window.moveBy(10, 20);
      }
  &lt;/script&gt;
  
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input type = "submit" value = "moveBy" onclick = "moveBy()"&gt; &lt;/input&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>