What is the equivalent of
var object = {
'foo': 'bar',
1: 42
}
using an ES6 Map?
The closest you can get is:
let object = new Map([
['foo', 'bar'],
['1', 42]
]);
Important things to notice:
In modern browsers it can be as simple as:
new Map(Object.entries(object))