How can I dynamically add more values in the sets defined as follows in Javascript:

```
var data1 = [
    { name: 'S1', elems: [0, 1, 2] },
    { name: 'S2', elems: [1, 2, 3] },
    { name: 'S3', elems: [0, 2, 4] },
  ];

```

What I want to do is similar to the following:

```
    (key, value) = read_a_row_from_table_of_values;
    if (key is present in data1) // could be by iterating all the keys in data 
    {
       data1[key][elems].push(value); // this is the point of concern (how to push values)
    }

```

As I am feeding this data to another tool (UpSet), so this data structure (in the form of name and elems) has to be followed. Details about that can be found [here](https://github.com/upsetjs/upsetjs/blob/7d633bd52e7f5d106458481ab644c3e97b44bc06/packages/model/src/data/asSets.ts#L84).