//Initialize map const map = new Map([['width', 1000], ['pickle', 2000], ['fun', 3000], ['big', 4000]]);
let obj; //Initialize map const map = new Map([['width', 1000], ['pickle', 2000], ['fun', 3000], ['big', 4000]]); //Now we "get" the value at the key prn(map.get('width')); prn(map.get('pickle'));
let map; //Now we "set" key-value pairs into map //Two styles (similar to "gettingValues") //Set values into map map = new Map(); map.set('width', 333); map.set('height', 444); prn(map.get('width')); prn(map.get('height'));
//Initialize map const map = new Map([['width', 1000], ['pickle', 2000], ['fun', 3000], ['big', 4000]]); //Iterate for (const keyValue of map){ prn(keyValue); } //Iterate (extracting from pair) for (const keyValue of map){ prn(`key is ${keyValue[0]}, value is ${keyValue[1]}`); }