If we want to add mapping to basic JavaScript data types, we need to start by considering our options:
- With null, undefined, and Symbol, applying maps doesn't sound too interesting.
- With the Boolean, Number, and String data types, we have some interesting possibilities, so we can examine some of those.
- Applying mapping to an object would be trivial: we just have to add a map() method, which must return a new object.
- Finally, despite not being basic data types, we could also consider special cases, such as dates or functions, to which we could also add map() methods.
As in the rest of this book, we are sticking to plain JavaScript, but you should look into libraries such as Lodash, Underscore, or Ramda, which ...