if elce in java scrigt code example
Example 1: if statements javascript
if (pros < 10) {
console.log("LESS THAN 10 PROS!");
}
else if (pros < 5) {
console.log("LESS THAN 5 PROS!");
}
else {
console.log("How many pros are there?");
}
Example 2: how many else statements can be added in javascript
if (condition a) {
// code that will execute if condition a is true
} else if (condition b) {
// code that will execute if condition b is true
} else if (condition c) {
// code that will execute if condition c is true
} else {
// code that will execute if all above conditions are false
}