Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript ternary operator

let showme || "if the variable showme has nothing inside show this string";
let string = condition ? 'true' : 'false'; // if condition is more than one enclose in brackets
let condition && 'show this string if condition is true';
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #ternary #operator
ADD COMMENT
Topic
Name
4+2 =