Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    > Going to an JavaScript Object < Shouldn't it have code to handle keys such as __proto__? Or you can damage the entire environment by trying to serialize such a map. Alok's response doesn't suffer from this, I believe.
    – roim
    Commented Oct 29, 2021 at 23:40
  • As pointed out in Oriol's answer, this is incorrect. Map keys can be objects, which this answer doesn't handle.
    – Stefnotch
    Commented Jul 28, 2022 at 15:55