1var data = {
2 'PropertyA': 1,
3 'PropertyB': 2,
4 'PropertyC': 3
5};
6
7data["PropertyD"] = 4;
8
9// dialog box with 4 in it
10alert(data.PropertyD);
11alert(data["PropertyD"]);
1let yourObject = {};
2
3//Examples:
4//Example 1
5let yourKeyVariable = "yourKey";
6yourObject[yourKeyVariable] = "yourValue";
7
8//Example 2
9yourObject["yourKey"] = "yourValue";
10
11//Example 3
12yourObject.yourKey = "yourValue";