Program to use Even and Odd Numbers in JavaScript Language
let a = 13;
if (a % 2 == 0) {
console.log("Number is Even");
} else {
console.log("Number is Odd");
}
Output
Number is Odd
Steps Description
- Declare variable
a
- Initialize variable with value of 13
a=13
- if statement
a
Modulus2
equal to0
is even number - else statement is odd number
console.log
inbuild function to displaya
variable