Standard built-ins

Map.prototype.get()

Try the free JavaScript compiler

Retrieve an entry value, or undefined if absent; use has to distinguish stored undefined.

Formal Syntax & Structure

javascript syntaxjavascript
map.get(key)

Parameters & Attributes

NameTypeDescription
keyAnyMap key; object keys use identity.

Return Value

Any

Stored value or undefined.

Working Example

Example Snippetjavascript
const m=new Map([["x",2]]);console.log(m.get("x"),m.get("y"));
JavaScript Reference