Created
July 24, 2024 09:29
-
-
Save Korveld/29da979fd35bc22eb4395225b4b41250 to your computer and use it in GitHub Desktop.
Ternary operator multiple conditions
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
var foo = ( | |
bar === 'a' ? 1 : // if | |
bar === 'b' ? 2 : // else if | |
bar === 'c' ? 3 : // else if | |
null // else | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment