Created
April 18, 2014 20:21
-
-
Save 1000hz/11062671 to your computer and use it in GitHub Desktop.
Nested ternaries can be nice if you do it right...
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
function dessertRank(dessert) { | |
return dessert === "muffins" ? "good" | |
: dessert === "brownies" ? "pretty good" | |
: dessert === "cupcakes" ? "great" | |
: dessert === "cookies" ? "amazing" | |
: dessert === "cake" ? "omg" | |
: dessert === "ice cream" ? "dying" | |
: "probably pretty great" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment