conditional shorthand javascript code example
Example 1: shorthand if statment in js
isLoggedIn ? "Logout" : "Login";
Example 2: examples of Conditional Operator js
var age = 19;
var canDrive = age > 16 ? 'yes' : 'no';
isLoggedIn ? "Logout" : "Login";
var age = 19;
var canDrive = age > 16 ? 'yes' : 'no';