Side effects

What are side effects? We can define these as a change in state or an interaction with outside elements (the user, a web service, another computer, whatever) that occurs during the execution of some calculations or a process. 

There's a possible misunderstanding as to the scope of this meaning. In common daily speech, when you speak of side effects, it's a bit like talking about collateral damage—some unintended consequences for a given action; however, in computing, we include every possible effect or change outside the function. If you write a function that is meant to perform a console.log() call to display a result, then that would be considered a side effect, even if it's exactly what you intended the function to do in the ...

Get Mastering JavaScript Functional Programming - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.