I have the following JS function:
let mapFunc = (key) => {
let map = {
a: 'first',
b: 'first',
c: 'first',
d: 'second',
e: 'second',
f: 'second'
}
return map[key];
}
console.log(mapFunc('b'))
Is there a way that I can write this function so that instead of having 6 different properties, I have only 2 properties, like this?
{
first: ['a', 'b', 'c']
second: ['d', 'e', 'f']
}