conditional javascript if code example
Example 1: javascript conditional
// example:
age >= 18 ? `wine` : `water`;
// syntax:
// <expression> ? <value-if-true> : <value-if-false>
Example 2: how to shorten conditional statements javascript
var canDrive = age > 16 ? 'yes' : 'no'