Object.assign({}, obj) permet de cloner l'obj.
code
let tabPers = [ {nom: "Dupont",
sex : "f",
},
{
nom: "Brusel",
sex : "h",
},
{
nom: "Dupont",
sex : "f",
},
];
function clone(person) {
return Object.assign({},person)
}
function transf(array, fx) {
let passed = [];
for(let v of array)
passed.push(fx(v));
return passed;
}
let T = transf(tabPers,clone);