[JS] Convert Map to Object
Simple example of convert a map to an object
let map = new Map();
map.set('banana', 1);
map.set('orange', 2);
map.set('meat', 4);
let obj = Object.fromEntries(map.entries()); // Converting
console.log(obj);
console.log(obj.orange); // 2
Comments