January 2020
Intermediate to advanced
470 pages
11h 13m
English
Finally, some functions also cause problems. For instance, Math.random() is impure: it doesn't always return the same value, and it would certainly defeat its purpose if it did! Furthermore, each call to the function modifies a global seed value, from which the next random value will be calculated.
For instance, consider the following function that generates random letters ("A" to "Z"):
const getRandomLetter = () => { const min = "A".charCodeAt(); const max = "Z".charCodeAt(); ...Read now
Unlock full access