Pages

End of saison 1

 

Special event


 Préparation à l'examen : PizzaJS

Function Style, Method Style

 The main difference between the function style and the use of the `filter() or map()` method lies 

in the programming paradigm they represent.


🥇**Function Style**: The function style represents the procedural programming paradigm.

🎖️ **Method Style**: The method style represents the functional programming paradigm.


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());


const nativeResult = Object.groupBy(languageSkills, (item) => item.skill);