Open this example in the interactive library
Source code
const source = new Map([
[1, "one"],
[2, "two"],
]);
const restored = new Map(JSON.parse(JSON.stringify([...source])));
console.log(restored.get(2));
Sample output
two

Open this example in the interactive library
const source = new Map([
[1, "one"],
[2, "two"],
]);
const restored = new Map(JSON.parse(JSON.stringify([...source])));
console.log(restored.get(2));
two