Last updated on November 20, 2017
Here is the simple JavaScript code snippet to check if the given number is an odd or even number.
Function to check Number Is Odd Or Even
function checkEven(val){ return (val%2 == 0); }
How to use checkEven
val = 9; if(checkEven(val)){ alert("Number is even"); } else { alert("Number is odd"); ]