Standard built-ins

Map.prototype.set()

Try the free JavaScript compiler

Insert or replace a key without moving an existing key. Returns the receiver.

Formal Syntax & Structure

javascript syntaxjavascript
map.set(key, value)

Parameters & Attributes

NameTypeDescription
keyAnyMap key; object keys use identity.
valueAnyValue to associate or insert.

Return Value

Map

Same map.

Working Example

Example Snippetjavascript
const m=new Map(); console.log(m.set("x",3)===m);
JavaScript Reference