JavaScript is a scripting language where semicolons as statement terminators are optional.  I have never found a conversation about this, I just stumbled across one and found it interesting.

Some of the points the author makes about why you should use semicolons are:

  • Spec is cryptic and JavaScript implementations differ
  • You can’t minify JavaScript code without semicolons
  • It’s good coding style
  • Semicolon insertion bites back in return statements

I am pretty obsessive about using semi-colons in my JavaScript.  It just makes it neat and organized in my opinion.  Also keeps me in sync with my PHP programming as well.

Advertisements