293
True crime (europe.pub)
you are viewing a single comment's thread
view the rest of the comments

i would say why would you just not to isAdmin = true but i also worked with someone who did just this so i'll instead just sigh.

also the real crime is the use of javascript tbh

[-] Lemminary@lemmy.world 22 points 1 day ago

That's TypeScript. I can tell by the pixels defining a type above.

[-] Maiq@lemy.lol 6 points 1 day ago

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

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 10 points 1 day ago* (last edited 1 day ago)

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 1 day 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.

[-] exu@feditown.com 3 points 22 hours ago
[-] Lemminary@lemmy.world 1 points 20 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. ๐Ÿ˜…

[-] Maiq@lemy.lol 4 points 1 day ago

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

[-] ScintillatingStruthio@programming.dev 1 points 3 hours ago* (last edited 3 hours ago)

Fair enough, I like it better without but I don't have a strong preference and have no issue adapting to whatever the style of the repo is.

I learned about it researching tools to automatically enforce formatting style and came across StandardJS, which eliminates them by default.

[-] Maiq@lemy.lol 1 points 2 hours ago

I can see the benefit of matching style when working with others. I only code for myself and never had to worry about conformity for project consistency.

It is good to learn new things.

I'm sure I have some coding habitats that would annoy others.

[-] Lemminary@lemmy.world 3 points 1 day ago

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

[-] Ephera@lemmy.ml 2 points 1 day ago

Hmm, a webdev colleague said he'd normally prefer without semicolons, but used them anyways for better compile errors.

Interesting, I'm not aware of any way they would affect compile errors. I'd be curious to know more.

load more comments (7 replies)
load more comments (7 replies)
load more comments (7 replies)
this post was submitted on 14 Aug 2025
293 points (96.2% liked)

Programmer Humor

25726 readers
1228 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