Lodash _.map() Method
The _.map() method creates an array of values by running each element in collection through the iteratee. There are many lodash methods that are guarded to work as iteratees for methods like _.every(), _.filter(), _.map(), _.mapValues(), _.reject(), and _.some() methods.
_.map( collection, iteratee )
Parameters: This method accepts two parameters as mentioned above and described below:
- collection: This parameter holds the collection to iterate over.
- iteratee: This parameter holds the function invoked per iteration.
Return Value: This method returns the new mapped array.
[ 25, 324 ]
[ 196, 784 ]
[ 'jonny', 'john' ]