The Array.map method will create a new array with what is returned by a given method that will be called for each element in the array. The first argument in the method that is passed is the current value of an element in the array, and the return keyword is usedd to return what will become the new value for the element in the array.
Now that we have a basic example of the native array map meth9d out of the way lets take a look at what can be done with the lodash equivalent of array map.
So of course the same thing can be done with the _.map method in lodash, and in more or less the same way. The only real difference compared to the native array map example is that I have to pass the array as the first argument as the lodash meth9od is not a prototype method but a stand alone method.
However _.map in lodash is a collection method, so it can also be used on plain old objects as well, not just Arrays.
For a more advanced example of _.map in action, say I have a complex object that has nested objects inside of it, and I want to toggle a boolean value for each object, and flatten everything out into an array. I can call _.map recursively on objects, and arrays. Other lodash methods like _.isArray, and _.flatten can also be used in the process.