Skip to content

Instantly share code, notes, and snippets.

@doug-numetric
Created July 24, 2017 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doug-numetric/39b1ae184fd95c343fc2978849f0a8eb to your computer and use it in GitHub Desktop.
Save doug-numetric/39b1ae184fd95c343fc2978849f0a8eb to your computer and use it in GitHub Desktop.
ESList and nested conditional operators
/*
* What are your thoughts on nested conditionals?
* replacing with if/else if/else statements removes your ability to use const
* ESLint doesn't like them, but for cascading if/else flows, I think proper formatting
* eliminates readability concerns
*/
const word =
isFoo ? 'a' : // if isFoo
isBar ? 'b' : // else if isBar
isBaz ? 'c' : // else if isBaz
'd' ; // else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment