title: JavaScript function, if else, isNaN
body: <p>I've tried to make a function where you're supposed to enter two numbers in two different boxes and loop it until you put in a valid number!</p>
  <pre><code>var x = parseInt(prompt(&quot;Please enter a number!&quot;));
  var y = parseInt(prompt(&quot;Please enter a number!&quot;));
  
  function add(x, y) {
  
      var z = x + y;
      var i = false;
  
      do {
          if (isNaN(x)) {
              alert(&quot;Invalid entry. Please enter a number!&quot;)
          } else if (isNaN(y)) {
              alert(&quot;Invalid entry. Please enter a number!&quot;)
          } else {
  
              alert(x + &quot; + &quot; + y + &quot; = &quot;);
              i = true;
          }
          while (i == false);
      }
  }
  
  add(x, y);
  </code></pre>