.map javscript code example
Example 1: 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!
Example 2: array mdn map
let new_array = arr.map(function callback( currentValue[, index[, array]]) {
// return element for new_array
}[, thisArg])