this post was submitted on 29 Dec 2023
230 points (80.3% liked)
Programmer Humor
32453 readers
848 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Can anyone explain it to me, please? ๐ฅน
In JavaScript, a const variable is an immutable constant that you cannot reassign. Similar to how many conservatives think of gender, an intrinsic fact of a person that you can only read, but never change.
The "let" keyword declares a variable in a local scope, the nearest surrounding curly braces. It can be changed in that scope, but does not exist anywhere else. I assume this is meant to concede that gender is a spectrum and your presentation can kind of wiggle, such as between "very manly" and "not as manly" but still a man. Like, a stereotypical lumberjack and a stereotypical twink are both men so there isn't "one way to be a man" but a conservative might say " but they are still men, you can change how you present but you can't change sex".
The "var" keyword lifts the variable definition to the top of the function, or "hoists" it up. A variable declared with var can be accessed and modified anywhere after the block it was declared in. Gender is a spectrum and it can be reassigned anywhere, at anytime, to anything.
I interpret it a bit differently. After all, a variable declared with
var
isn't really more capable of being rebound, or bound to more values, than one declared withlet
. However, it is possible, withvar
, that setting a variable in one place could change it unexpectedly in another, so Rose Noble coming out as trans could cause Jordan Peterson to also suddenly be a woman.similar to how most liberals think of gender
I thought this was obvious.
Const keyword means constant, a value that won't change after the application has been compiled; this allows for certain optimizations.
Let keyword is a JavaScript variable that is safely scoped down to the method or function level.
Var keyword is generally discouraged in JavaScript, because it's a global declaration. The value of it could be available anywhere in the application, and the app might have collisions.
So, the meme is, shifting from a constant, unchanging gender, to the middle where gender is defined and scoped to a local level, to the extreme, where gender is variable globally.