Created
September 18, 2012 15:10
-
-
Save chrisjpowers/3743662 to your computer and use it in GitHub Desktop.
JavaScript Syntax Question
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
// Do you prefer... | |
if (a) { | |
doA(); | |
} else if (b) { | |
doB(); | |
} else { | |
doC(); | |
} | |
// or... | |
if (a) { | |
doA(); | |
} | |
else if (b) { | |
doB(); | |
} | |
else { | |
doC(); | |
} | |
// Similarly, this... | |
try { | |
doSomething(); | |
} catch (e) { | |
console.log(e); | |
} | |
// or... | |
try { | |
doSomething(); | |
} | |
catch (e) { | |
console.log(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the fist captures the idea of a logical block better, which, I think, is more valuable than any potential lost clarity by condensing it. (also, as mentioned, saves screen real estate)