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
1 2 3 |
function checkEven(val){ return (val%2 == 0); } |
How to use checkEven
1 2 3 4 5 6 |
val = 9; if(checkEven(val)){ alert("Number is even"); } else { alert("Number is odd"); ] |
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.
Subscribe
Login
0 Comments