if and else if in javascript code example
Example 1: else statement
var age=20;
if (age < 18) {
console.log("underage");
} else {
console.log("let em in!");
}
Example 2: else if javascript
if (condition1) {
} else if (condition2) {
} else {
}
Example 3: how to use if else statement in javascript
var condition = true;
if (condition == true) {
console.log('condition is true');
} else {
console.log('condition is not true');
}
Example 4: javascript if or
let A = 1;
let B = 0;
if (A == 1 || B == 1){
}