3 ms·
If it can tell you forgot the semicolon it probably can do without it, so why doesn’t it? ;)
by loloquwowndueo 5y ago
If it can tell you forgot the semicolon it probably can do without it, so why doesn’t it? ;)
- astura 5y agoJavaScript has automatic semicolon insertion and I'm not a fan
- dudeman13 5y agoAh, but are you not a fan because of the automatic semicolon insertion or because... well, JavaScript :P
- junon 5y agoBecause it's a massive headache to debug code that has subtle bugs due to missing semi-colons.
- williamdclt 5y agoNever happened to me TBH. There's very few cases where the semicolon is actually significant, and when it happens my autoformatter produces garbage which makes it very obvious, or it adds the semicolon itself. That doesn't mean it never happens (most of us inherited a shitty codebase lacking things like code standards and autoformatting at some point), but I always find it strange that people keep talking about this thing I've never experienced in years writing JS professionally
- zabzonk 5y agog++ (and I assume other compilers) may diagnose it as missing either a comma (because of the comma operator) or a missing semicolon (can't find the end of statement) - silently providing one or the other would not be a good idea. Actually, I remember Jerry Pournelle asking exactly the same question about Pascal in Byte magazine in the 1980s.
- bookofsand 5y agoAmbiguity. 95% of the cases you forgot the semicolon, the other 5% you forgot something else.