"Hey, what's your policy on using semicolons in JavaScript?"

"Never. You don't need'em. Well, for loops. They're required there.

"And null loops such as: while (something);. But you probably shouldn't be using those anyway, right?

"Oh, and case "foo": doSomething(); break

"Er, and in front of a leading ( or [ at the start of the line. Can't forget that. Otherwise the expression could be interpreted as a function call or property access, respectively.

"Well, and I guess lines starting with - and + need to be prefixed with a semicolon, but that'll probably like never come up.

"But yeah, just don't forget those simple edge cases and you'll be fine. It's really pretty simple. You'll probably only waste a few hours occasionally on stupid little things you forgot."

"Simple, eh? I have a pretty simple rule when to use them, too: always. Much easier to remember!"


Thanks to npm's style guide that helped me write this article by showing me just how foolish the don't use them policy is for semicolons in JavaScript.