Variable
ELI5 — The Vibe Check
A variable is a named box where you store information. You put a number or a word in the box, give the box a name, and then you can grab it later by that name. The value inside can change — that's why it's called a VAR-iable.
Real Talk
A variable is a named storage location in memory that holds a value. In most languages you declare a variable with a keyword (let, var, int), a name, and optionally an initial value. Its value can be reassigned throughout the program's execution.
Show Me The Code
let score = 0;
score = score + 10;
console.log(score); // 10
When You'll Hear This
"Store the user's name in a variable." / "That variable is being mutated in three different places."
Related Terms
Constant
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.
Dynamic Typing
Dynamic typing is like a box that can hold anything — toys, food, or a cat — and you don't have to label what goes in it ahead of time.
Scope Creep
Scope creep is when a simple feature request slowly grows into rebuilding the entire application.
Type Inference
Type inference is the compiler being smart enough to figure out what type something is without you having to spell it out.