this post was submitted on 14 Aug 2025
294 points (96.2% liked)

Programmer Humor

25730 readers
1229 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
[–] Maiq@lemy.lol 6 points 1 day ago (13 children)

Was looking at it and could not figure out why their weren't any semicolon's.

[–] ScintillatingStruthio@programming.dev 13 points 1 day ago (12 children)

Neither Javascript nor Typescript require semicolon, it is entirely a stylistic choice except in very rare circumstances that do not come up in normal code.

[–] Lemminary@lemmy.world 12 points 1 day ago* (last edited 1 day ago) (3 children)

Explanation for nerdsThe reason is the JS compiler removes whitespace and introduces semicolons only "where necessary".

So writing

function myFn() {
  return true;
}

Is not the same as

function myFn() {
  return 
    true;
}

Because the compiler will see that and make it:

function myFn() { return; true; }

You big ol' nerd. Tee-hee.

[–] exu@feditown.com 4 points 1 day ago (1 children)
[–] Lemminary@lemmy.world 1 points 23 hours ago

Not wrong, but funnily enough, it's a linting rule win. I'd go nuts if I didn't have my type checks and my linters. My current L, though, is setting up the projects initially and dealing with the configuration files if I raw dog it, but that's a problem with ESLint configs and the ecosystem as a whole having to deal with those headaches. So in the end, the JS devs got clever and shifted the blame to the tooling. 😅

load more comments (1 replies)
load more comments (9 replies)
load more comments (9 replies)