offline version v3


⊗jsPmIMMp 278 of 502 menu

map method to iterate over an array in JavaScript

map

Given an array of numbers. Using the map method, extract the square root of each array element and write the result to a new array.

Given an array with strings. Using the map method, add the character '!' to the end of the value of each array element.

Given an array with strings. Using the map method, reverse the characters of each string.

Given the following array:

let arr = ['123', '456', '789'];

Using the map method, transform this array into the following:

let arr = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ];

Given an array of numbers. Using the map method, write to each element of the array the value of this element multiplied by its index number in the array.

enru