Wouldn't the IDE pointed it out?
42 0 ReplyYes.
Besides, Javascript doesn't need semicolon since 2016.
17 0 Reply33 1 ReplyAutomatic Semicolon Insertion (ASI) has (sadly) been a part of JavaScript longer than 2016. I'm not sure exactly when it was introduced, but this document from 2009 already contains it: https://web.archive.org/web/20120418215856/https://ecma262-5.com/ELS5_Section_7.htm#Section_7.9
IMO it's bad practice to rely on ASI since the semicolons may not get inserted where you expected them to. The following snippet
const x = 0 const y = x [1, 2, 3].forEach(console.log)
is interpreted as
const x = 0; const y = x[1, 2, 3].forEach(console.log);
which raises a
TypeError
.There are more examples of ASI not doing the right thing on the web, so I don't agree with "Javascript doesn't need semicolon".
19 1 Reply[This comment has been deleted by an automated system]
3 0 Reply
Only someone who is really into mental torture would not use a linter.
7 0 ReplyObviously, you patch the IDE so it doesn't
1 0 Reply
The IDE will tell you and fix it for you.
22 0 ReplyNot if they use GNU nano or that shitty windows notepad.
5 0 Reply
Jokes on them I don’t use semicolons in JavaScript
5 0 Reply