# JS syntax - dictionaries
[[JS Syntax]]
### dictionaries
Constructing a dictionary
```js
var dict = {
Key1: "Value1",
Key2: "Value2",
}
```
Adding a new entry (key-value pair)
```js
dict["Key3"] = "Value3"
```
Updating an existing value
```js
dict["Key1"] = "NewValue1"
dict.Key1 = "NewNewValue1"
```
Adding to an existing value
```js
dict["Key2"].push("AnotherValue2")
```
Using a list as a dictionary value
```js
dict["Key4"] = []
```
Appending to an existing value (*that is a list*)
```
dict.Key4.push("Value4")
dict.Key4.push("Value5","Value6")
```
#### test/example code block
```dataviewjs
const dict = {
Key1: "Value1",
Key2: "Value2",
}
dict["Key1"] = "NewValue1";
dict.Key1 = "NewNewValue1"
dict["Key3"] = "Value3";
dict["Key4"] = []
dict["Key4"].push("Value4");
dict["Key4"].push("Value5","Value6");
dv.paragraph(dict)
```