Pure Functions and Side Effects
Functions that always return the same output for the same input and don't modify anything outside themselves, versus functions that mutate state or perform I/O.
A pure function is one that, given the same inputs, always produces the same output, and produces no observable side effects — it doesn't mutate external variables, doesn't perform I/O, doesn't modify its arguments, and doesn't rely on anything besides its inputs to compute its result. This concept comes from functional programming, but it matters in everyday JavaScript because pure functions are dramatically easier to test, reason about, memoize, and run in parallel or out of order.
A pure function is like a vending machine that dispenses the exact same snack every time you press the same button, using only the button press as input — no memory of previous purchases, no side conversations with other machines, and pressing the same button twice never changes anyone else's snack.