Skip to content

javascript.builtins.Map.getOrInsert - Deno supports this method in version 2.6.7+ #29652

@kwj

Description

@kwj

What type of issue is this?

Incorrect support data (example: BrowserX says "86" but support was added in "40")

What information was incorrect, unhelpful, or incomplete?

Deno doesn't support the Map.prototype.getOrInsert() method.

What browsers does this problem apply to, if applicable?

Deno

What did you expect to see?

Deno supports the Map.prototype.getOrInsert() method in version 2.6.7 and later.

Did you test this? If so, how?

I verified this by running the following command in Deno 2.6.6 and 2.6.7

deno eval 'console.log(Deno.version); const map = new Map([["bar", "foo"]]); console.log(map.getOrInsert("bar", "default")); console.log(map.getOrInsert("baz", "default"));'

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

No response

Do you have anything more you want to share?

[Execution result]

$ ./2.6.6/deno eval 'console.log(Deno.version); const map = new Map([["bar", "foo"]]); console.log(map.getOrInsert("bar", "default")); console.log(map.getOrInsert("baz", "default"));'
{ deno: "2.6.6", v8: "14.2.231.17-rusty", typescript: "5.9.2" }
error: Uncaught (in promise) TypeError: map.getOrInsert is not a function
    at file:///home/kwj/tmp/$deno$eval.mts:1:83

$ ./2.6.7/deno eval 'console.log(Deno.version); const map = new Map([["bar", "foo"]]); console.log(map.getOrInsert("bar", "default")); console.log(map.getOrInsert("baz", "default"));'
{ deno: "2.6.7", v8: "14.5.201.2-rusty", typescript: "5.9.2" }
foo
default

[Related information]

The incorrect support information of Deno is also provided for the following methods.

  • Map.prototype.getOrInsertComputed()
  • WeakMap.prototype.getOrInsert()
  • WeakMap.prototype.getOrInsertComputed()

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/getOrInsert

MDN metadata

MDN page report details
  • Query: javascript.builtins.Map.getOrInsert
  • Report started: 2026-05-11T18:02:41.343Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    javascriptPull requests that update javascript codep3Medium priority – Community PRs encouraged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions