different ways of doing an if statement javascript using ? code example
Example 1: if and if and else javascript
if (expression 1) {
Statement(s) to be executed if expression 1 is true
} else if (expression 2) {
Statement(s) to be executed if expression 2 is true
} else if (expression 3) {
Statement(s) to be executed if expression 3 is true
} else {
Statement(s) to be executed if no expression is true
}
Example 2: how to make an if statement in javascript
if(condition1) {
}else if (condition2) {
} else {
}