Answers for "javascript push dictionary into array"

2

javascript push dictionary into array

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

dict.push({
    key:   "keyName",
    value: "the value"
});
Posted by: Guest on February-25-2021
0

javascript add to a dictionary

var d = {}

for (var i in input) {
    var datum = input[i];
    d[datum.key] = datum.val
}
Posted by: Guest on May-30-2020

Code answers related to "javascript push dictionary into array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language