Nested Conditional with Compound Statements

If the number is 9
    say it is 9
    say fun
otherwise
    if the number is 0
        say it is 0
    otherwise
        say it is neither
        say boring

Enter a number, script checks for 9


  <script>
    function checkValue(){
      var val = document.getElementById("num").value;
      if (val == 9) {
        alert("the number entered is 9");
        alert("this is fun");
        }
      else {
        if (val == 0)
          alert("Hey, that's a 0");
        else {
          alert("the number entered is not 9 or 0");
          alert("this is kinda boring");
          }
        }
    }
  </script>