if else short js code example
Example 1: shorthand if statment in js
isLoggedIn ? "Logout" : "Login";
Example 2: javascript if shorthand
condition ? doThisIfTrue : doThisIfFalse
1 > 2 ? console.log(true) : console.log(false)
// returns false
isLoggedIn ? "Logout" : "Login";
condition ? doThisIfTrue : doThisIfFalse
1 > 2 ? console.log(true) : console.log(false)
// returns false