dict js code example
Example 1: get keys of dictionary js
let dict = { a:1 , b:2 , c:3 }
console.log( Object.keys(dict) )
Example 2: 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 3: 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]
}
}
Example 4: js dictionary
var dict = {
FirstName: "Chris",
"one": 1,
1: "some value"
};