javascript add to a dictionary

JavaScript
var dict = []; // create an empty array

dict.push({
    key:   "keyName",
    value: "the value"
});
// repeat this last part as needed to add more key/value pairshow to add array to list in c#for (var i = 0; i < input.length; i++) {
    var datum = input[i];
    if (!d[datum.key]) {
        d[datum.key] = [];
    }
    d[datum.key].push(datum.val);
}obj["key3"] = "value3";var d = {}

for (var i in input) {
    var datum = input[i];
    d[datum.key] = datum.val
}
Source

Also in JavaScript: