Settings

Theme

JavaScript Semicolons Are Not Necessary

lennu.net

3 points by Lennu 10 years ago · 3 comments

Reader

partycoder 10 years ago

From Google, authors of V8 and Chrome, if their opinion means anything to you: https://google.github.io/styleguide/javascriptguide.xml?show...

alexc05 10 years ago

I remember having a bug once in (I think) IE8 where I had a comma after the last element an an array (like the 'greatarray' shown in this article.

The browser didn't accept a comma after the last element in an array and IIRC the compiler breaks so badly that it puts the reported error at line 1 character 1, possibly for a different file entirely.

Spent a LONG time on that.

I kind of reject his assertion that JavaScript without semi colons is "better code"

The logic, flow, maintainability, understandability, performance and, actually doing the right thing all make for better code.

Semicolons? Not so much.

mcbits 10 years ago

Semicolon presence or absence is usually the least annoying factor to me in how other people write their JavaScript code.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection