Is it correct that whenever the getVal function is called, a new dictionary should be created and its values replaced?
var dict = [];
function getVal(inarr, element, data) {
var arr = inarr[element].map((item) => item[data]);
return arr;
};
console.log(getVal(event, 'foo', 'bar'));