Jokes on them I don’t use semicolons in JavaScript

doomkernel
link
fedilink
411Y

Wouldn’t the IDE pointed it out?

Only someone who is really into mental torture would not use a linter.

Yes.

Besides, Javascript doesn’t need semicolon since 2016.

Skull giver
link
fedilink
2
edit-2
1Y

[This comment has been deleted by an automated system]

Wait, did you just made a meme of my comment?

Awesome!

Glad you take it like a champ :)

@angel@iusearchlinux.fyi
link
fedilink
English
17
edit-2
1Y

Automatic 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”.

@kinttach@lemm.ee
link
fedilink
English
51Y

As Mark Twain said, “Never discuss politics, semicolons, tabs, or religion in polite company.”

Use an autoformatter for all code (both in the editor on save/type and as CI check).

There is no problem anymore.

Obviously, you patch the IDE so it doesn’t

Dandroid
link
fedilink
221Y

The IDE will tell you and fix it for you.

Not if they use GNU nano or that shitty windows notepad.

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 61 users / day
  • 247 users / week
  • 417 users / month
  • 2.88K users / 6 months
  • 1 subscriber
  • 1.53K Posts
  • 33.9K Comments
  • Modlog