const languageSkills = [
{
language: "Spanish",
skill: "Professional Proficiency",
},
{
language: "English",
skill: "Professional Working Proficiency",
},
{
language: "German",
skill: "Professional Proficiency",
},
];
const output = languageSkills.reduce((map, { language, skill }) => {
if (map.has(skill)) map.get(skill).push(language);
else map.set(skill, [language]);
return map;
}, new Map());
console.log(...output);