Creates an array of values by running each element in collection thru iteratee. The iteratee is invoked with three arguments: (value, index|key, collection).
Example
functionsquare(n) { returnn * n }
map([4, 8], square) // [16, 64]
map({ a:4, b:8 }, square) // [16, 64] (iteration order is not guaranteed)
letusers = [ { user:'barney' }, { user:'fred' } ]
// The `property` iteratee shorthand. map(users, 'user') // ['barney', 'fred']
Creates an array of values by running each element in collection thru iteratee. The iteratee is invoked with three arguments:
(value, index|key, collection)
.Example
Returns
Returns the new mapped array.
See
Array.map()