You probably already know how to do what I just described using a for loop on the array.
(I know, that’s not the sort of complex rocket science you often need to do for your sophisticated application, but understanding how it works in a simple case like this will help you apply it in cases where it can add real value to your code). For example, imagine that you have an array of words, and you need to transform that into an array that contains the length of each word. To make that a little bit more concrete, let’s come up with a simple use case. Mapping is a fundamental functional programming technique for operating on all of the elements in an array and producing another array of the same length with transformed contents.