Last active
May 14, 2021 03:02
-
-
Save pjcodesjs/db67c3c3e3ad2aa9e2776c3e742d63b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REGULAR IF/ELSE | |
const cat_love_checker = (status) => { | |
if (status === false) { | |
return 'Sigh... my cat does not love me :('; | |
} else { | |
return 'Aha! My cat does love me!'; | |
} | |
} | |
cat_love_checker(false); // Sigh... my cat does not love me :( | |
// TERNARY OPERATOR | |
const cat_love_checker = status => ( | |
status === false ? 'Sigh... my cat does not love me :(' : 'Aha! My cat does love me!' | |
); | |
cat_love_checker(false); // Sigh... my cat does not love me :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment