Map

Let map = new Map();

map.set('1', 'str1');   // a string key
map.set(1, 'num1');     // a numeric key
map.set(true, 'bool1'); // a boolean key

// remember the regular Object? it would convert keys to string
// Map keeps the type, so these two are different:
alert( map.get(1)   ); // 'num1'
alert( map.get('1') ); // 'str1'

alert( map.size ); // 3

It calls the function for each element of the array and returns the array of results.

Is a collection of keyed data items, just like an Object.

Syntax

Let result = arr.map(function(item, index, array) {
  // returns the new value instead of item
})

Map — Structure map

Clickable & Draggable!

Map — Related pages: