Return Value
ELI5 — The Vibe Check
A return value is what a function hands back to you after doing its work. You send a coffee machine beans and water, it returns coffee. If a function returns nothing, it just does a task and walks away without giving you anything.
Real Talk
A return value is the output that a function sends back to its caller via the return statement. The caller can store it in a variable or use it directly. A function with no return value has a void or None return type.
Show Me The Code
function add(a: number, b: number): number {
return a + b; // this is the return value
}
const sum = add(3, 4); // sum === 7
When You'll Hear This
"Capture the return value and log it." / "The function has no return value — it just mutates state."
Related Terms
Argument
An argument is the actual value you hand to a function when you call it.
Function
A function is a reusable recipe. You write the steps once, give it a name, and call it whenever you need those steps done.
Parameter
A parameter is the placeholder name inside a function definition — it's the label on the slot where you plug things in.
Pure Function
A pure function is the well-behaved kid of programming.
Side Effect
A side effect is when a function secretly does something beyond just giving you an answer — like changing a global variable, writing to a file, or sending...