javascript Map () method code example
Example 1: map in javascript
['elem', 'another', 'name'].map((value, index, originalArray) => {
console.log(.....)
});
Example 2: array map
let numbers = [1, 4, 9]
let roots = numbers.map(function(num) {
return Math.sqrt(num)
})
// roots is now [1, 2, 3]
// numbers is still [1, 4, 9]