It is often necessary to generate a new array based on the values of an existing array.
For example, to generate an array of string lengths from an array of strings:
5.1
['one', 'two', 'three', 'four'].map(function(value, index, arr) {
return value.length;
});
// → [3, 3, 5, 4]
6
['one...