Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript add to a dictionary

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);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #add #dictionary
ADD COMMENT
Topic
Name
2+7 =