Side effects
Functions have side effects in these instances
- When a function reassigns a non-local (or outside of function scope) variable.
- When a function mutates an object value referenced by a non-local variable.
- When reading or writing to a file, network connection, browser or the console.
- When a function raises an exception without handling the exception.
- When a function calls another function that has side effects.
Functions should return a useful value OR have a side effect, but not BOTH.