Check one by one condition.
Syntax
if(expression){
//content to be evaluates
} else if(expression) {
//content to be evaluates
} else{
//content to be evaluates
}
Example
var a=10;
if(a>5){
document.write("Value of a is greater than 5");
} else if(a<5) {
document.write("Value of a is less than 5");
} else{
document.write("Value of a is equal to 5");
}
Copyright ©2022 coderraj.com. All Rights Reserved.