this post was submitted on 22 Nov 2025
655 points (98.7% liked)

Programmer Humor

29166 readers
854 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
 

cross-posted from: https://lemmy.ml/post/39334581

you are viewing a single comment's thread
view the rest of the comments
[–] SpaceCowboy@lemmy.ca -5 points 2 months ago (15 children)

Yeah for whatever reason, FE devs want to make everything a const. It's like a religious belief or something, it's really kinda weird.

const fun = () => { const something = "whatever" const array = []; array.push(someting)

for (const thing of array) { if (thing === 'whatever') blah(thing) } }

Semicolons? Optional. Which quotes you should use? Whatever you feel like! But you must declare things as a const wherever possible! Even if it's an array that you're going to be changing, declare it as a const because you should know that you can push things into a const array, and since it's possible to declare it as a const, you must declare it as a const.

Why is this? Nobody knows, but it's important to FE devs that you use const.

[–] brian@programming.dev 2 points 2 months ago (9 children)

semicolons? quotes? use a formatter and don't think about it. I think js world has basically done this already.

const is simpler. why would I declare an array as let if I'm not reassigning? someone can look at it and know they don't have to think about reassignment of the reference, just normal mutation. ts has the further readonly to describe the other type of mutation, don't abuse let to mean that.

const arrow over named function? gets rid of all the legacy behaviors and apis. no arguments, consistent this, and no hoisting or accidental reassignment. the 2 places you should ever use named fn are generator or if you actually need this

[–] SpaceCowboy@lemmy.ca -3 points 2 months ago (5 children)

Stylistically, you're changing the array when you add something to it. Javascript is a janky language in the best of times, but FE devs like to artificially introduce additional unnecessary complexities on top of the jank.

const is simpler. why would I declare an array as let if I’m not reassigning?

Why would you declare a const that's going to have different data every time to function is called?

Now I'm thinking it's a form of gatekeeping. Just an excuse for FE devs to throw out terms like "immutable" to make it sound like they know what they're taking about. Y'all need to constantly sound like you know what you're talking about when dealing with users, pretending weird stylistic choices have real technical reasons for them. But the BE devs know what you're saying is complete bullshit LOL.

[–] brian@programming.dev 2 points 2 months ago

knowing the programming language you're working in at a basic level is gatekeeping I'm ok with

load more comments (4 replies)
load more comments (7 replies)
load more comments (12 replies)