Voici les dupont/dupond
Compléter les codes des fonctions forEach, trans, filter
const dupontd = [
{ name: "Dupont", sex: "m" },
{ name: "DUPONT", sex: "m" },
{ name: "duPont", sex: "f" },
{ name: "dupond", sex: "f" }
];
--------------------------------------- A compléter ----------------------------
function forEach(t, fx) {
}
function trans(t, fx) {
}
function filter(t, fx) {
}
----------------------------- les callbacks ------------------------------
function upperCase(pers) {
pers.name = pers.name.toUpperCase();
}
function isDupont(pers) {
return pers.name == "DUPONT"
}
function civilite({ name, sex }) {
sex == 'm' ? name = `Monsieur ${name}` : name = `Madame ${name}`
return { name }
}
----------------------------------- APPELS -------------------------------------
forEach(dupontd, upperCase);
const dupontFamily = filter(dupontd, isDupont)
const tid = trans(dupontFamily, civilite)