Exercise in JS || Simple Exercise in JavaScript

In this video,I explained a Simple Exercise in JavaScript. Feel free to comment. For more, please subscribe and press the BELL icon. Please visit my JavaScript Playlist
Please visit my YouTube Videos. The code is as follows -

HTML Code -
<html>
  <head>
    <script>
  function even_odd() {
    var x = parseInt(document.getElementById("no").value);
if (x % 2 == 0)
{
  alert("Its a Even Number");
}
    else {
  alert("Its a Odd Number");
}
  }
</script>
  </head>

  <body>
  <form>
     Enter any number:-  <input type="number" id="no">
<button onclick="even_odd()"> Check the number </button>
<input type="reset" value="Reset">
  </form>
  </body>

</html>


Comments

Popular posts from this blog

Property and Attribute Binding in Angular || Displaying Data and Handling Events

Indian Flag || Indian Flag using HTML CSS