title: Why won't my break work in my if else statement in javascript?
body: <p>I have been working on a small game where you ask people to spell a random number from 1-10. </p>
  
  <p>I've done this by using an <code>if/else</code> statement. I've tried to add a feature where if the user enters the word 'quit', the game will display an alert saying 'Goodbye' and the game will break. But when I test it, and enter the word 'quit', it displays an alert saying 'Goodbye', but it will not break. </p>
  
  <p>I've tried to figure out the solution, but I just can't figure it out. Any helpful hints? </p>
  
  <p>P.S I'm new to coding, please do not judge my lack of knowledge.</p>
  
  <pre><code>var numSpelling = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"];
  var num;
  var answer;
  var i;
  
  alert('If you want to exit the game, just enter the word quit');
  
  for (i = 0; i &lt; 10; i++) {
  
    num = Math.floor(Math.random() * 10) + 1;
  
    answer = prompt('What is the spelling for the number ' + num);
  
    while (true) {
      if (answer == 'quit') {
        alert('Goodbye');
        break;
      } else if (answer == numSpelling[num]) {
        alert('Correct');
        break;
      } else {
        alert('Incorrect');
        answer = prompt('Please try to spell ' + num + ' again')
      }
    }
  }
  </code></pre>