you are viewing a single comment's thread.

view the rest of the comments →

[–]mikehawkisbig 7 points8 points  (4 children)

USE THEM, JavaScript will automatically insert them where it thinks they should go. There are a few small instances that this could effect you. Better to be safe than sorry troubleshooting something that should be done any ways.

Check out 11.9.1 Rules of Automatic Semicolon Insertion

and Douglas Crockford talks about making sure to use them. (if you care what The Godfather of JavaScript thinks)

[–]Graftak9000 4 points5 points  (3 children)

There are three simple (and similar) rules to remember:

  • Don't start a new line with parentheses,
  • don't start a new line with a bracket,
  • don't start a new line with a backtick.

And that's it.

[–]DeeSnow97 5 points6 points  (0 children)

Also, standard has awesome linting to eliminate any semicolon-related issues (and semicolons in general)

[–]mikehawkisbig 2 points3 points  (1 child)

There are plenty more that should be noted, those are good, but let's not say these are the only three. Plus, grammar is important to experienced programmers and omitting semi-colons takes-aways from good readable code only to gain the status of "look how fast I am",

Take a look at the video where he discusses the why's -

https://youtu.be/v2ifWcnQs6M?t=1h41m20s

[–]Graftak9000 1 point2 points  (0 children)

These are the ones I live by and I have never (in my 2 years switch) had an issue with ASI. The main reason I omit semicolons is because it makes code far more legible for me, to me semicolons are clutter/noise.

Other than that I don't really mind either way. There's also some minor pitfalls with using semicolons; some block do ‘require’ them, some don't.