January 2020
Intermediate to advanced
470 pages
11h 13m
English
5.1. Filtering... but what? Suppose you have an array, called someArray, and you apply the following .filter() to it, which at first sight doesn't even look like valid JavaScript code. What will be in the new array and why?
let newArray = someArray.filter(Boolean);
5.2. Generating HTML code, with restrictions: Using the filter()...map()...reduce() sequence is quite common (even allowing that sometimes you won't use all three), and we'll come back to this in the Functional design patterns section in Chapter 11, Implementing Design Patterns – The Functional Way. The problem here is how to use those functions (and no others!) to produce an unordered list of elements (<ul>...</ul>) that can later be used onscreen. Your input is an ...
Read now
Unlock full access