title: How to stop this while loop from crashing the browser?
body: <p>I have to use a while loop for this project, I know a for loop is probably easier but just the way this has to be done. </p>
  
  <p>The function needs to take user input (1-5) based on how many job duties the user wants to see and then call the array number (0-4), so if they say 3 job duties, array items 0,1,2 need to be printed. This is what I have so far and it keeps crashing the browser, not sure how to control the loop and make sure it prints out all the array values instead of just one.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
         function jobduties() {
         var x = document.getElementById("input").value;
         var y = x-1;
         var duties = ["Sales", "Customer Service", "Management", "Driving", "Cleaning"]; 
         while (x&gt;=0) {
         var y
         document.getElementById("print").innerHTML=duties[y];
         break;
         }       
       }
  &lt;/script&gt;
  
  &lt;form&gt;
  </code></pre>
  
  <p>Clickto see  job duties for this job.
  </p>
  
   
  Job duties here
  </p>