Javatpoint Logo
Javatpoint Logo

JavaScript Array map() method

The JavaScript array map() method calls the specified function for every array element and returns the new array. This method doesn't change the original array.


The map() method is represented by the following syntax:


callback - It represents the function that produces the new array.

currentvalue - The current element of array.

index - It is optional. The index of current element.

arr - It is optional. The array on which map() method operated.

thisArg - It is optional. The value to use as this while executing callback.


A new array whose each element generate from the result of a callback function.

JavaScript Array map() method example

Let's see some examples of map() method.

Example 1

Here, map() method returns the round of given elements to the nearest integer.

Test it Now



Example 2

Here, map() method returns every element of given array by multiplying it by 3.

Test it Now



Next TopicJavaScript Array

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA