Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

map duplicate keys JS

// One can create a unique map. When there are two same keys, they can be stored as:

const map = {
    "Truck": [{ "Red": true }],
    "Compact Sedan": [{ "Black": false }, { "Blue": false }]
}

map["Compact Sedan"][0]; // { "Black": false }
map["Compact Sedan"][1]; // { "Blue": false }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #map #duplicate #keys #JS
ADD COMMENT
Topic
Name
9+8 =