map() method creates a new array with the results of calling a provided function on every element in this array.
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.
Returns the created array.
var numbers = [1, 4, 9]; var roots = numbers.map(Math.sqrt); console.log("roots is : " + roots );
roots is : 1,2,3