News for hackers. Stuff that matters.
Re:Writing great Javascript by MatthewPhillips on Friday March 23, 2012 @08:33PM (#3748019)
I've never seen the preceding semi-colon like that. It makes perfect sense, there are a lot of JavaScript coders these days coming from languages like Ruby and these people often don't use semi-colons, very smart advice to protect against that!
Re:Writing great Javascript by pshc on Friday March 23, 2012 @09:48PM (#3748185)
Adding a leading semicolon just in case seems like overly defensive programming to me. You ought to pick trustworthy tools. If your script concatenator doesn't work right, I think it's better to fail fast rather than let things quietly be half-broken all over the place.
Re:Writing great Javascript by csomar on Saturday March 24, 2012 @07:06AM (#3749060)
You ought to pick trustworthy tools.

Many JavaScript snippets are made to be integrated and added by other people on their websites.

Re:Writing great Javascript by sn0wright on Friday March 23, 2012 @09:04PM (#3748083)
The preceding semi-colon is definitely a very smart advice. I also will have to try out jshint (I've been using jslint).
Re:Writing great Javascript by Perceptes on Saturday March 24, 2012 @05:51AM (#3748951)
It doesn't even need to be a semicolon. It's also common to see a ! used for this purpose.