ES6 - Array Method map()

map() method creates a new array with the results of calling a provided function on every element in this array.

Syntax[, thisObject]);   


  • callback − Function that produces an element of the new Array from an element of the current one.

  • thisObject − Object to use as this when executing callback.

Return Value

Returns the created array.


var numbers = [1, 4, 9]; 
var roots =; 
console.log("roots is : " + roots );    


roots is : 1,2,3 
Kickstart Your Career

Get certified by completing the course

Get Started