this post was submitted on 14 Aug 2025
282 points (96.4% liked)

Programmer Humor

25705 readers
1274 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 23 hours ago (8 children)

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

[–] ScintillatingStruthio@programming.dev 11 points 21 hours ago (7 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 9 points 20 hours ago* (last edited 20 hours 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.

[–] Ephera@lemmy.ml 7 points 20 hours ago

That's terrifying, especially in JS where no type system will fuck you up for returning nothing when you should've returned a boolean.

load more comments (2 replies)
load more comments (5 replies)
load more comments (5 replies)