Logo

Programming-Idioms

History of Idiom 8 > diff from v53 to v54

Edit summary for version 54 by javajosh:
New JS implementation by user [javajosh]

Version 53

2019-09-26, 19:36:58

Version 54

2019-09-26, 19:49:53

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
let x = new Map([["a",1],["b",2]]);
Comments bubble
The Map constructor can take an array of [key, value] pairs.
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
Demo URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map