var age=20; if (age < 18) { console.log("underage"); } else { console.log("let em in!"); }
if (hour < 18) { greeting = "Good day"; } else { greeting = "Good evening"; }
/* Shorten if-else by ternary operator*/ const go = "yes" let race = null race = go === "yes" ? 'Green Light' : 'Red Light';
if (condition) { // block of code to be executed if the condition is true }
if (hour < 18) { greeting = "Good day"; }
if (condition) { } else if (other_condition) { } else { }