Say we have an existing Map:
const m1 = new Map([['color', 'red'], ['owner', 'Flavio'], ['age', 2]])
if we want to create a new map, is it enough to do:
const m2 = new Map(m1);
or maybe instead:
const m2 = new Map(Array.from(m1))
MDN says you could do this.
const first = new Map([
[1, "one"],
[2, "two"],
[3, "three"]
]);
const second = new Map([
[1, "uno"],
[2, "dos"],
[3, "tres"]
]);
const merged = new Map([...first, ...second]);
console.log(merged.get(1))