Skip to content

Side Effect

Medium — good to knowGeneral Dev

ELI5 — The Vibe Check

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 an email. It's when the function has impact outside its own little world.

Real Talk

A side effect is any observable change that a function causes beyond returning a value — mutating external state, modifying a database, writing to the console, making a network request, or altering a variable outside its scope.

Show Me The Code

let count = 0;

// This function has a side effect — it mutates external state
function increment() {
  count++; // side effect!
}

// Pure function — no side effects
function add(a: number, b: number) {
  return a + b;
}

When You'll Hear This

"That function has side effects — it mutates the global store." / "Isolate side effects at the edges of your application."

Made with passive-aggressive love by manoga.digital. Powered by Claude.