Multiple Conditions

If, else if and else condition also supports multiple conditions.

Code Structure
// && means you have to meet both condition for statement to be true.
if(age > 18 && country === "UK"){
 alert("You are allowed to drink.");
} else {
 alert("You are not allowed to drink.");
}

// || means any one condition can be meet for statement to be true.
if(age > 18 || education === "Bachelor"){
 alert("You can apply");
} else {
 alert("You cannot apply");
}

Share this

Related Posts