and or javascript if code example
Example 1: javascript and
var hungry=true;
var slow=true;
var anxious=true;
if(hungry && slow && anxious){
var cause="weed";
}
Example 2: else if javascript
if (condition1) {
} else if (condition2) {
} else {
}
Example 3: if and if and else javascript
if (expression 1) {
Statement(s) to be executed if expression 1 is true
} else if (expression 2) {
Statement(s) to be executed if expression 2 is true
} else if (expression 3) {
Statement(s) to be executed if expression 3 is true
} else {
Statement(s) to be executed if no expression is true
}