August 2017
Beginner
374 pages
10h 41m
English
However, there are many more versions of side effects that are not related to modifying the state outside of the function. In fact, any effect that does not contribute to the return value is considered a side effect. That includes functions such as this:
function counter (i) { console.log('i =', i) return i + 1}
Calling console.log in the preceding function causes a side effect. Technically speaking, all functions have some side effects (such as taking time and consuming memory). Usually when we talk about side effects, we are most concerned with IO and modifying the external state.
Read now
Unlock full access