Is there a 'bar' key in the hashmap that has an array as its value with only one item ['foo']? I want to add another item, 'foo1', to the same array. Is the following code the right approach, or is there a simpler way to achieve this?
var map1 = new Map();
map1.set('bar', ['foo']);
var newValues = map1.get("bar");
map1.set('bar' ,newValues.concat('foo1'));
console.log(map1.get('bar')); // ['foo', 'foo1']