map in nodejs model code example
Example 1: initialize a map js
let map = new Map()
map['bla'] = 'blaa'
map['bla2'] = 'blaaa2'
console.log(map)
Example 2: map in javascript
let myMap = new Map()
let keyString = 'a string'
let keyObj = {}
myMap.set(keyString, "value associated with 'a string'")
myMap.set(keyObj, 'value associated with keyObj')
myMap.set(keyFunc, 'value associated with keyFunc')
myMap.size
myMap.get(keyString)
myMap.get(keyObj)
myMap.get(keyFunc)
Example 3: map in javascript
['elem', 'another', 'name'].map((value, index, originalArray) => {
console.log(.....)
});