this post was submitted on 29 Dec 2023
206 points (78.8% liked)
Programmer Humor
32710 readers
120 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
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.
JavaScript does not have compile-time constants (it’s usually not compiled after all). The
const
keyword declares an immutable variable.Variables declared with
let
are scoped to the block, not to the function.var
is scoped to the function, not globally (unless it’s at the global level). It is discouraged because of its confusing semantics (“variable hoisting”).