javascript or in if statement code example
Example 1: 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 2: javascript if and statement
let a = 1;
let b = 2;
if(a == 1 && b ==2){
}
Example 3: javascript if or
let A = 1;
let B = 0;
if (A == 1 || B == 1){
}
Example 4: if statement javascript
const randomObject = 5;
if(randomObject < 2) {
console.log("The Random Object has a value more than 2");
}
else {
console.log("The Random Object has a value less than 2");
}
Example 5: 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?");
}