Standard built-ins
Map.prototype.set()
Insert or replace a key without moving an existing key. Returns the receiver.
Formal Syntax & Structure
javascript syntaxjavascript
map.set(key, value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | Any | Map key; object keys use identity. |
| value | Any | Value to associate or insert. |
Return Value
Map
Same map.
Working Example
Example Snippetjavascript
const m=new Map(); console.log(m.set("x",3)===m);