Answers for "map function in javascript es6"

2

functions in map javascript

const map = new Map();

function foo() {
 return "Hello World!"; 
}

map.set("foo", foo);

console.log(map.get("foo")()); // Output: "Hello World!
Posted by: Guest on May-13-2020
0

JavaScript Map Function

const myAwesomeArray = [5, 4, 3, 2, 1]

myAwesomeArray.map(x => x * x)

// >>>>>>>>>>>>>>>>> Output: [25, 16, 9, 4, 1]
Posted by: Guest on December-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language