A side effect is an application state change that happens outside of the called function—to be precise, any state change other than its return value.
Here are some examples of side effects:
- Modifying a global variable
- Modifying a variable in a parent scope chain
- Writing to the screen
- Writing to the file
- Any network request, for instance, an AJAX request
This section on side effects is meant to get you ready for the next chapter, where we will talk about pure functions in the context of Redux. Also, we will push these ideas much further in Chapter 9, Functional Programming Patterns, where you will learn how we can benefit from functional programming practices, such as mutable and immutable objects, higher order functions, and monads.