Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript if else

/* Shorten if-else by ternary operator*/
const go = "yes"
let race = null

race = go === "yes" ? 'Green Light' : 'Red Light';
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript
ADD COMMENT
Topic
Name
9+7 =