A side effect is an observable interaction with external state or the outside world beyond producing a return value. Pure functions avoid side effects, making them predictable, testable, and easier to debug. section 3.2
Impure versus pure functions
increment changes the external counter before returning it, so repeated calls depend on prior state. add only computes from its arguments. Similarly, nums.map(n => n * 2) returns a new array without changing nums when its callback is pure. section 3.2
Useful interview checks include:
- Determine whether console.log inside a function counts as a side effect. section 3.2
- Explain how immutability and referential transparency support predictable reasoning about code. section 3.2



























