title: Javascript while loop makes the page not load
body: <p>When I put this in my header:</p>
  
  <pre><code>&lt;script&gt;
  function checkiffinished() {
    var n = $('.result-row').length;
    while (n!==3)
    {
    n = $('.result-row').length;
    $("span").text("There are " + n + " divs.");
    };
  
    };
  &lt;/script&gt;
  </code></pre>
  
  <p>Then in the body put  </p>
  
  <pre><code>&lt;script&gt;
   checkiffinished();
   &lt;/script&gt;
  </code></pre>
  
  <p>then the page crashes.</p>
  
  <p>The code is supposed to count the number of divs with the "result-row" class and repeat that until the number of divs with aforementioned class is 3.</p>
  
  <p>How can I make it so as such and not crash the page?</p>
  
  <p>EDIT 1: other jQuery I have in the page causes there to be .result-row elements on another event, that's why I need it to check periodically.</p>
  
  <p>EDIT2 : I'm trying to run this in parallel with some other jQuery that manipulates the elements on the page.</p>