if (foo) {
bar;
}
can be shortened to
if(foo) bar;
since it's only one statement in the block.
I'm wondering if the same applies to try/catch... I don't like extra cruft in my code.
According to ECMAScript 5, a block is required, which means you need the curly braces.
TryStatement :
try Block Catch
try Block Finally
try Block Catch Finally
Catch :
catch ( Identifier ) Block
Finally :
finally Block
Block :
{ StatementList opt }
StatementList :
Statement
StatementList Statement