November 2017
Intermediate to advanced
386 pages
9h 22m
English
Processing lists of elements, and applying some kind of operation to each of them, is a quite common pattern in computer programming. Writing loops that systematically go through all the elements of an array or collection, starting at the first and looping until finishing with the last, and doing some kind of process to each of them, is a basic coding exercise, usually learned in the first days of all programming courses. We already saw one such kind of operation in the previous section, with .reduce() and .reduceRight(); let's now turn a new one, called .map().
In mathematics, a map is a transformation of elements from a domain into elements of a codomain. For example, you might transform numbers into strings, ...