2 ms·
I wish they were. It can cause unexpected problems. http://bonsaiden.github.com/JavaScript-Garden/#semicolon http://bonsaiden.github.com/JavaScript-Garden/#sem
by drivebyacct2 16y ago
I wish they were. It can cause unexpected problems.
http://bonsaiden.github.com/JavaScript-Garden/#semicolon http://bonsaiden.github.com/JavaScript-Garden/#semicolon
(this really wasn't the example that I was thinking of, I'll scrounge for the other examples, sorry)
- jacobolus 16y agoThat example has nothing to do with whether semicolons are omitted or not; the rule that you need to know is don’t ever put a newline between the “return” keyword and the value to be returned, but whether you add semicolons at the end of what you want to make a statement makes absolutely no difference in this case. In other words, whether you write return foo; or return foo the result is the same: an empty return, completely ignoring the foo bit.
- drivebyacct2 16y agoRight, but if it wasn't "autoinserting" semicolons, the behavior would be different.
- jacobolus 16y agoThat doesn’t have any bearing on whether human programmers should add unnecessary semicolons to lines where there is no such ambiguity.