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 kitt.lewagon.com #
 
PREVIOUS NEXT
Tagged: #javascript
ADD COMMENT
Topic
Name
6+4 =