One formatting style we discussed was the use of new lines in code blocks. Here are three common formatting styles for the same code:
Style 1
if (true) {
console.log('yay!');
} else {
console.log('boo!');
}
Style 2
if (true) {
console.log('yay!');
}
else {
console.log('boo!');
}
Style 3
if (true)
{
console.log('yay!');
}
else
{
console.log('boo!');
}
When I first starting coding, I preferred Style 3, since it provides more visual separation. Currently I prefer Style 2, although it's not even a formatting option at http://jsbeautifier.org/, which makes me question my choice a little. Douglas Crockford seems to prefer Style 1, so maybe I should consider making the switch.
Which do you prefer?