let one = ['a', 'b', 'c']
let two = ['1', '2', '3']
switch(inp){
case in one:
// do one
break;
case in two:
// do two
break;
}
switch (true) {
case one.includes(inp):
...
break;
case two.includes(inp):
...
break;
}
const arr = [
{
values: [ ... ],
action: () => { ... },
},
{
values: [ ... ],
action: () => { ... },
},
];
arr.find(n => n.values.includes(inp))?.action();
let one = ['a', 'b', 'c'];
let two = ['1', '2', '3'];
const inp = '2';
const foundList = [one, two].find(list => list.includes(inp));
switch (foundList) {
case one: console.log('one'); break;
case two: console.log('two'); break;
}
if (... one) then
{...}
else if (...two) then
{...}
indif