Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Last active September 23, 2017 18:20
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 primaryobjects/5510fbfd003a71c10e39c58a1e7b9442 to your computer and use it in GitHub Desktop.
Save primaryobjects/5510fbfd003a71c10e39c58a1e7b9442 to your computer and use it in GitHub Desktop.
Which conditional would you write in JavaScript and why?
// A
if (isActive)
doIt();
// B
if (isActive) {
doIt();
}
// C
isActive && doIt();
1. Which is the shortest?
2. Which is the easiest to read?
3. Which is the easiest to maintain?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment