4 ms·
Readability is the single most important quality of a piece of code. Semicolons aid readability by eliminating ambiguity and ensuring that nobody ever has to s
by jasonkester 16y ago
Readability is the single most important quality of a piece of code. Semicolons aid readability by eliminating ambiguity and ensuring that nobody ever has to spend even a second figuring out whether your code will do what it looks like it will do.
I add semicolons for the same reason I surround if blocks with braces, pad out blocks with whitespace, and avoid the ternary operator in all but the most trivial cases. If you ever find yourself dropped onto a line of my code by a debugger, chances are you'll be able to figure out exactly what's going on immediately.
At least that's the goal.
(more here: http://expatsoftware.com/articles/2007/06/getting-your-priorities-straight.html http://expatsoftware.com/articles/2007/06/getting-your-prior... )
- keefe 16y agoThis is one of the hardest things to learn about software and why it's so nice to work with people with similar style. I always use semicolons in js. I love the ternary operator on short bits of code though. foo(something==null?somethingElse:something);