Description

map() creates a new array populated with the results of calling a passed function on every element in the calling array.

Syntax

const array = [1, 2, 3, 4];
const map1 = array.map((x) => x * 2);
 
console.log(map1); // [(2, 4, 6, 8)]