SHORTHAND IF Statment di JS
isLoggedIn ? "Logout" : "Login";
Mushy Magpie
isLoggedIn ? "Logout" : "Login";
let showme || "if the variable showme has nothing inside show this string";
let string = condition ? 'true' : 'false'; // if condition is more than one enclose in brackets
let condition && 'show this string if condition is true';
const answer = x > 10 ? "greater than 10" : "less than 10";
// or
if (something)
return;
// other code here