Simple conditional with an Else Clause

If the number is 9
    say it is 9
otherwise
   say it is not

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");
      else
        alert("the number entered is not 9");
    }
  </script>