nom: "Dupont",
sex : "f",
},
{
nom: "Brusel",
sex : "h",
},
{
nom: "Dupont",
sex : "f",
},
];
Le tableau tabPers |
function femme(person) {
return (person.sex === "f");}
function civiliteF(person) {
return (` Cher(e) ${person.nom}`);}
function filter(array, test) {
let passed = [];
for (let val of array) {
if (test(val))
passed.push(val);
}
return passed;
}
let tabFiltre = filter(tabPers,femme);