If...else statements to check for NaN and empty string not working in JavaScript
<p>I refactored FizzBuzz using functions and everything is working great except for two if..else statements in the function meant to validate the user's input (validateValue). I want to alert users that empty strings, decimals and NaN are not allowed. The statement checking for decimals works, but not empty strings or NaN. When I enter an empty string or NaN, the prompt for no decimals appears. I want to fix this using vanilla JavaScript, no jQuery. </p>

<p>Here is the JavaScript:</p>

<pre><code>function getValue(message) {
  var msg = "Please enter a number from 1 to 100.";
  if (message) {
    msg = message;
  }
    return parseInt(prompt(msg)); 
}

function validateValue(num) { 
  if (num === "") { 
    return getValue("Please type something."); 
  } else if (num%1 !== 0) { 
    return getValue("No decimals allowed."); 
  } else if (isNaN(num)) { 
    return getValue("That is not a number!"); 
  } else {
    return num; 
  }
}

function fizzBuzz(num) {
   for (var i = 1; i &lt;= num; i++) {
   if (i%15 === 0) {
    document.getElementById("list").innerHTML += "FizzBuzz&lt;br&gt;";
   }
   else if (i%3 === 0) {
    document.getElementById("list").innerHTML += "Fizz&lt;br&gt;";
  }
  else if (i%5 === 0) {
    document.getElementById("list").innerHTML += "Buzz&lt;br&gt;";
  }
  else {
    document.getElementById("list").innerHTML += i + "&lt;br&gt;";
  }
}
}

  var value = validateValue(getValue());
  fizzBuzz(value); 
</code></pre>

<p>Here is the HTML:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8" /&gt;
    &lt;title&gt;FizzBuzz Refactor&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div&gt;
    &lt;p&gt;Your FizzBuzz results:&lt;/p&gt;
    &lt;ul id="list"&gt;
    &lt;/ul&gt;
    &lt;/div&gt;
    &lt;script type="text/javascript" src="app.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>