![]() |
VOOZH | about |
Lodash _.map() method creates an array of values by running each element in the collection through the 'iteratee'. Many methods are guarded to work as iteratees for methods like _.every(), _.filter(), _.map(), _.mapValues(), _.reject(), and _.some() methods.
_.map(collection, iteratee)This method returns the new mapped array.
Example 1: In this example, we have used the _.map() method on an array and do iteration while using function square.
Output:
[ 25, 324 ]Example 2: In this example, we have used the _.map() method on an object and doing iteration while using function square.
Output:
[ 196, 784 ]