Use semicolons. Always. It's looks cleaner, and you won't come up against stupid errors like<p><pre><code> return
{
foo: 7
}
</code></pre>
From the article -<p><pre><code> When you're done trying to wrap your brain around
why would anyone in their right mind want to write
a return statement on a new line
</code></pre>
Well, if they love having { on newlines, then it's pretty obvious:<p><pre><code> function foo()
{
return
{
bar: 8
}
}
</code></pre>
From the article -<p><pre><code> That's 24 bytes right there. Stamp semicolons
everywhere and run it through a minifier:
var a=1;var b=2;var c=3;
</code></pre>
Yeah um, hate to break it to you, but a minifier (and any experienced coder) would write it as "var a=1,b=2,c=3;"<p><pre><code> // after minification
if(condition){stuff()}
</code></pre>
Wrong again. Use a better minifier. Closure advanced mode for example will remove the {}, inline functions if it makes sense and hundreds of other things.<p><pre><code> Easy solution: when a line starts with parenthesis,
prepend a semicolon to it.
;(d + e).print()
</code></pre>
Ugly horrible hacky advice.<p>I remember when I first saw C code (coming from BASIC) and thought similar thoughts - eugh what are all those useless semicolons they don't do anything what's the point of them etc.<p>One important point is that it allows you to rearrange the whitespace in your code, without changing the execution meaning of your code. Which is pretty useful in making your code beautiful and readable and avoiding bugs.