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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.