using map object in javascript code example
Example 1: object to map javascript
const map = new Map(Object.entries({foo: 'bar'}));
map.get('foo'); // 'bar'
Example 2: javascript map
function listFruits() {
let fruits = ["apple", "cherry", "pear"]
fruits.map((fruit, index) => {
console.log(index, fruit)
})
}
listFruits()
// https://jsfiddle.net/tmoreland/16qfpkgb/3/
Example 3: javascript map to object
Object.fromEntries(Map)