I skimmed through the book and think I saw a function declared inside an if-statement. Some JS engines don't like that. And if the engine does support it, the function will be function scoped. To make an if-scoped function, declare it using const f = x => y,
nitpick:
I personally prefer to use intermediate variables instead of nested function calls and ternary operator.
nitpick: I personally prefer to use intermediate variables instead of nested function calls and ternary operator.