if clause teminates the workflow in JavaScript? : <p>When I look at the following code, I think "CheckChoice(IntSelect)" will always execute no matter "if (isNaN(IntSelect))" will execute or not.</p>

<p>If I input a NaN and the CheckChoice function worked, the alert("The value supplied is out of range!"); should also display as the "default" branch. But it does not happen as I expected.</p>

<p>I do not understand what happens when input is a NaN, can anybody explain it please.</p>

<p>Thank you.</p>

<pre><code>&lt;!DOCTYPE html&gt;

&lt;html&gt;
&lt;head&gt;
   &lt;title&gt;Using the Default Clause&lt;/title&gt;
   &lt;script language="JavaScript"&gt;
      function CheckChoice(option)
      {
         // Make a selection.
         switch (option)
         {
            case 1:
               document.getElementById("Result").innerHTML =
                  "You chose Item A.";
               break;
            case 2:
               document.getElementById("Result").innerHTML =
                  "You chose Item B.";
               break;
            case 3:
               document.getElementById("Result").innerHTML =
                  "You chose Item C.";
               break;
            default:
               // Display an error dialog.
               alert("The value supplied is out of range!");
               break;
         }
      }

      function MakeAChoice()
      {
         // Ask the user to provide input.
         var Selection = prompt("Type a menu option.");

         // Convert the string to a number.
         var IntSelect = parseInt(Selection);

         // Verify the user has provided a number.
         if (isNaN(IntSelect))
         {
            // Display an error dialog.
            alert("Please provide numeric input!");

            // Return without doing anything more.
            return;
         }

         // Call the selection function.
         CheckChoice(IntSelect);
      }
   &lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
   &lt;h1&gt;Using the Default Clause&lt;/h1&gt;
   &lt;p&gt;Menu Options:&lt;/p&gt;
   &lt;ol&gt;
    &lt;li&gt;Item A&lt;/li&gt;
    &lt;li&gt;Item B&lt;/li&gt;
    &lt;li&gt;Item C&lt;/li&gt;
   &lt;/ol&gt;
   &lt;input type="button"
          value="Choose a Menu Item"
          onclick="MakeAChoice()" /&gt;
   &lt;p id="Result"&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
