convert object to map 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 to object
Object.fromEntries(Map)
const map = new Map(Object.entries({foo: 'bar'}));
map.get('foo'); // 'bar'
Object.fromEntries(Map)