JS: Literal Expression for Map
Literal Expression for Map
There's no literal expression for map. But you can pass in a literal expression of array of array, like this:
new Map([ [k1, v1], [k2, v2], etc])
const xx = new Map([[3, "n3"], [4, "n4"]]); console.log(xx); // Map { 3 => "n3", 4 => "n4" }
Note: the map constructor (new Map()
) does not accept a object datatype.
γsee Map Constructorγ
γsee Convert Object to Map πγ
JavaScript, Map Object
- JS: Map Object Tutorial
- JS: Difference, Object vs Map
- JS: Literal Expression for Map
- JS: Nested Map
- JS: Iterate Map Object
- JS: Convert Object to Map π
- JS: Convert Map to Object π
- JS: Map Equality π
- JS: Map Filter π
- JS: Swap Key Value of Map π
- JS: Sort Map π
- JS: Truncate Map π
- JS: Map Substract π
- JS: How Map Determines Uniqueness of Keys
- JS: Map Object
- JS: Map Constructor
- JS: Map.prototype