if else syntax javascript code example
Example 1: IF else statement
var age=20;
if (age < 18) {
console.log("underage");
} else {
console.log("let em in!");
}
Example 2: using if statements in javascript
if (expression) {
Statement(s) to be executed if expression is true
} else {
Statement(s) to be executed if expression is false
}
Example 3: javascript if else
var age=20;
if (age < 18) {
console.log("underage");
} else {
console.log("let em in!");
}
Example 4: else if javascript
if (condition1) {
} else if (condition2) {
} else {
}
Example 5: javascript how to do if else
if (condition1) {
} else {
}
Example 6: javascript if statement
if (5 < 10) {
console.log("5 is less than 10");
} else {
console.log("5 is now bigger than 10")
}