Logo

Programming-Idioms

History of Idiom 8 > diff from v49 to v50

Edit summary for version 50 by yuchi:
[JS] Add also values

Version 49

2019-09-26, 14:56:58

Version 50

2019-09-26, 14:58:39

Idiom #8 Initialize a new map (associative array)

Declare a new map object x, and provide some (key, value) pairs as initial content.

Idiom #8 Initialize a new map (associative array)

Declare a new map object x, and provide some (key, value) pairs as initial content.

Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Code
const x = new Map();
Code
const x = new Map();
x.set("one", 1);
x.set("two", 2);
Comments bubble
From ES2015
Comments bubble
From ES2015
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map