We can do
let myMap = new Map()
myMap.set(keyString, "value associated with 'a string'")
myMap.set(keyObj, 'value associated with keyObj')
myMap.set(keyFunc, 'value associated with keyFunc')
which will work like:
myMap.get(keyString) // "value associated with 'a string'"
myMap.get(keyObj) // "value associated with keyObj"
myMap.get(keyFunc) // "value associated with keyFunc"
But this process will become cumbersome if you have very large data. So is there a way like:
let myMap = new Map({
keyString: value1
keyObj:value2
keyFunc: value3
})
I know the above code is wrong, but I want to know is there a way to do that?