this post was submitted on 04 Dec 2024
57 points (90.1% liked)

Programmer Humor

19813 readers
468 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] Eranziel 2 points 2 weeks ago (1 children)

Semicolons are technically optional in JS, but there are some rare cases where omitting them can result in different behaviour.

And this is why you should enforce code style, kids. Preferably with an automated tool.

[โ€“] Excigma 1 points 2 weeks ago* (last edited 2 weeks ago)

I'm on my phone rn so can't format well, but one such example is:

const thing = require("module")

(async () => { something })()

without a ; at the end of the first line, JavaScript will try to do require("module")() instead