javascript if statement multiple conditions code example
Example 1: multiple conditions for JavaScript .includes() method
const str = "hi, there"
const res = str.includes("hello") || str.includes("hi") || str.includes('howdy');
console.log(res); // true
Example 2: else if javascript
if (condition1) {
// code to be executed if condition1 is true
} else if (condition2) {
// code to be executed if the condition1 is false and condition2 is true
} else {
// code to be executed if the condition1 is false and condition2 is false
}
Example 3: javascript if
if (32 == 32) {
console.log('32 is equil to 32!');
}
Example 4: multiple conditions in javascript
let str = "fuck it I don't care";
let results = []
let results[0] = str.includes("hello") || str.includes("hi") || str.includes("howdy");
console.log(results[0]);