conditional statement logic javascript code example
Example 1: javascript if elseif
if (condition) {
} else if (other_condition) {
} else {
}
Example 2: javascript if else
/* Shorten if-else by ternary operator*/
const go = "yes"
let race = null
race = go === "yes" ? 'Green Light' : 'Red Light';