November 2017
Intermediate to advanced
386 pages
9h 22m
English
You also need to be aware of the possibility that an impure function will modify its arguments. In JS, arguments are passed by value, except in the case of arrays and objects, which are passed by reference. This implies that any modification to the parameters of the function, will effect an actual modification of the original object or array. This can be furthermore obscured by the fact that there are several mutator methods, that change the underlying objects by definition. For example, say you wanted a function that would find the maximum element of an array of strings (of course, if it were an array of numbers, you could simply use Math.max() with no further ado). A short implementation could be as follows:
const maxStrings ...
Read now
Unlock full access