title: JavaScript -- while loop
body: <p>I'm learning about how to use <code>while loop</code>, and came up with a scenario where <code>while loop</code> might be applicable.</p>
  
  <p>Supposing that 20 or so pictures with similar urls are arranged in a page like below:
  <code>http://img7.italian.uk/pastaimages/6253.jpg</code><br>
  <code>http://img7.italian.uk/pastaimages/4218.jpg</code><br>
  <code>http://img7.italian.uk/pastaimages/7657.jpg</code><br>
  ... (according to this pattern, only the last part of urls is different for each picture) ...</p>
  
  <p>Among all the pictures that start with the url <code>http://img7.italian.uk/pastaimages/*</code>, if the first one is <code>http://img7.italian.uk/pastaimages/6253.jpg</code>, just refresh the current page.</p>
  
  <p>And as long as the first picture is the "6253" one, the same action repeats itself.</p>
  
  <p>But once the first picture is no longer the "6253" one, then stop that loop and click the current first picture with the <code>http://img7.italian.uk/pastaimages/*</code> url like "3585" or 8291 etc.</p>
  
  <p>I'm not sure how to go about this.</p>
  
  <pre><code>while (// 1st image === 6253) {
      //refresh the current page
  }
  // once 1st image is no longer 6253, stop the loop and
  // click the current first picture that ends with something like 3585, 8291 etc.
  </code></pre>