If and Else Statement

If Statement execute a block of code if a specified condition is true and else statement execute if the condition is false.

Code Structure
var country = prompt("Where are you from?");
if(country === "UK"){
 alert("You are from Europe.");
} else {
 alert("You are from Asia.");
}

Share this

Related Posts