javascript how to create a dictionary code example
Example 1: dictionary in javascript
let myDictionary = {
"value 1": "string",
"value 2": 2,
"value 3": ["array value 1", "array value 2"]
};
var value1 = myDictionary["value1"];
var value2 = myDictionary["value2"];
var value3 = myDictionary["value3"];
Example 2: how to make a dictionary javascript
var test_dictionary = {
"This is a key" : "This is the value of this key",
"You can make many keys" : {
"Integer" : 123,
"String" : "Hello, world!",
"Boolean" : true,
"Array" : [1,2,3,4,5]
}
}