Answers for "conditional (ternary) operator function parameter"

0

conditional (ternary) operator function parameter

//Instead of:
var welcomeMessage  = 'Hello ' + (username ? username : 'guest');

//Can use:
var welcomeMessage  = 'Hello ' + (username || 'guest');
Posted by: Guest on October-17-2021
0

conditional (ternary) operator function parameter

serveDrink(userIsYoungerThan4 ? 'Milk' : userIsYoungerThan21 ? 'Grape Juice' : 'Wine');
Posted by: Guest on October-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language