javascript es6 if else if code example
Example: javascript if else
/* Shorten if-else by ternary operator*/
const go = "yes"
let race = null
race = go === "yes" ? 'Green Light' : 'Red Light';
/* Shorten if-else by ternary operator*/
const go = "yes"
let race = null
race = go === "yes" ? 'Green Light' : 'Red Light';