Constant
ELI5 — The Vibe Check
A constant is a box you seal shut after putting something in. You can look inside any time you want, but you can't swap out what's in there. It's perfect for things that should never change, like the number of days in a week.
Real Talk
A constant is an immutable variable — its value is set once and cannot be reassigned. Constants communicate intent to other developers and prevent accidental mutations. They are declared with const in JS/TS, final in Java, or let in Rust.
Show Me The Code
const MAX_RETRIES = 3;
const API_BASE_URL = "https://api.example.com";
// MAX_RETRIES = 5; // TypeError: Assignment to constant variable
When You'll Hear This
"Put that magic number in a constant with a good name." / "Never hardcode values — use constants."
Related Terms
Boilerplate
Code you have to write every single time you start a project but that doesn't actually do anything interesting.
Enum
An enum is a named list of options that are all related.
Pure Function
A pure function is the well-behaved kid of programming.
Variable
A variable is a named box where you store information.