if statement ternary operator javascript code example
Example 1: examples of Conditional Operator js
var age = 19;
var canDrive = age > 16 ? 'yes' : 'no';
Example 2: javascript ternary
condition ? doThisIfTrue : doThisIfFalse
1 > 2 ? console.log(true) : console.log(false)
// returns false