Side Effect

Noun · Development

Definitions

  1. Any observable change a function makes beyond returning a value — such as writing to disk, mutating global state, sending a network request, or modifying a passed-in reference. Functions without side effects are called pure and are easier to test and reason about.

    In plain English: When a piece of code changes something outside itself, like saving a file or updating a database, instead of just computing an answer.

    Example: "This function looks innocent, but it has a side effect — it writes to localStorage every time you call it."

Related Terms