looking for better way than having switch statement in array.map for javascript. Basically is there a better way to change all the values in an array given an object or something? In this case i want to abbreviate or change all the values of an array to different values given. should i use another map or another object? Javascript Es6 question I have this:
const abvDepartments = departments.map(equip => {
switch (equip) {
case 'service':
return 'Svc';
break;
case 'help':
return 'HLP';
break;
case 'contracts':
return 'Con';
break;
default:
return '';
}
});
breakafter areturn.