6 ms·
Here's what Crockford has to say on the subject: "One of the mistakes in the language is semicolon insertion. This is a technique for making semicolons optiona
by davidsiems 16y ago
Here's what Crockford has to say on the subject:
"One of the mistakes in the language is semicolon insertion. This is a technique for making semicolons optional as statement terminators. It is reasonable for IDEs and shell programs to do semicolon insertion. It is not reasonable for the language definition to require compilers to do it. Use semicolons."
http://javascript.crockford.com/survey.html http://javascript.crockford.com/survey.html
I'm inclined to agree. You already have to deal with enough complexity while you're programming, why add more? It's easier to follow the rule 'always use semicolons' than to try to selectively use them.
- mcantelon 16y agoThe counter to that argument is "You already have to deal with enough visual noise while you're programming, why add more?". Semi-colon insertion rules aren't that complicated. To me, it's a matter of what style project participants are comfortable with.
- rimantas 16y agoRules may not be complicated. Seeing where and how they should be applied in the sea of code, some you did not write—entirely different story.
- deleted 16y ago[deleted]
- artsrc 16y agoI agree use semicolons. Or longer: Because JavaScript allows semicolon insertion some syntax is parsed in a way which is surprising to those skilled with other curly brace languages. This can causes problems if you do or don't try to leave out semicolons. The solution to avoiding unexpected behavior is to run JSLint. JSLint will insist that you use semicolons. So you will have to use semicolons.