I want to add values to empty object to their correct key that is received dynamically.
Obviously the following does not work because I replace the existing value of that key with the latest value:
let obj = {};
let key;
let value;
key = // from selectors
value = // from selectors
obj[key] = value;
How can I "push" the new value to that key instead of replacing it?
For example if value1 and value2 were chosen after 2 iterations with key1 then the end result of the object would be
{"key1": ['value1', 'value2']}