this post was submitted on 14 Aug 2025
158 points (95.4% liked)

Programmer Humor

25699 readers
1626 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
[–] ScintillatingStruthio@programming.dev 7 points 5 hours ago (2 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 6 points 4 hours ago* (last edited 4 hours ago) (1 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 1 points 1 hour ago

Common JavaScript L

[–] Maiq@lemy.lol 3 points 4 hours ago (1 children)

That's good to know. Don't know how I didn't know this. Been writing JS since 2000. Always just used them I guess. Ecmascripts look funny to me without them

[–] Lemminary@lemmy.world 2 points 4 hours ago

Same here. My brain interprets them as one long run-on sentence and throws a parsing error.