Standard built-ins
Map.prototype.get()
Retrieve an entry value, or undefined if absent; use has to distinguish stored undefined.
Formal Syntax & Structure
javascript syntaxjavascript
map.get(key)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | Any | Map 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"));