Javascript Map() Function

The map() function of array object creates a new array with the results of calling a provided function on every element in this array. Use it for example to perform some operation on each element of array and create new array.

Syntax

Javascript Map() Function Example1

This will produce following result

Javascript Map() Function Example2

This will produce following result

Javascript Map Method Example3

This will produce following result