w3schools javascript else if code example
Example 1: if condition javascript
if (condition){
// if true then execute this -}
else{
// if statment is not true then execut this -
}
Example 2: javascript if else
/* Shorten if-else by ternary operator*/
const go = "yes"
let race = null
race = go === "yes" ? 'Green Light' : 'Red Light';