js if else statement code example

Example 1: IF else statement

var age=20;
if (age < 18) {
	console.log("underage");
} else {
	console.log("let em in!");
}

Example 2: javascript if statement

if (5 < 10) {
	console.log("5 is less than 10");
} else {
	console.log("5 is now bigger than 10")
}

Example 3: how to make an if statement in javascript

if(condition1) { //runs if the condition is true
  //type what you want to happen if the condition is true
}else if (condition2) {
  //type what you want to happen if the condition is true
} else { //If no condition is true it will run this
  //type what you want it to do
}

Example 4: if then else

if then else