Pages

td

const pers =  [
{nom: "Dupont",ville: "evry",sex: "f",born:1903},
{nom: "Dupont",ville: "Paris",sex: "f",born:2004},
{nom: "Brusel",ville: "belfort",sex: "h",born:1930}
];

Ecrire un code pour afficher :





minMax =function({max,min}, cur){
 return {max:Math.max(max,cur),min:Math.min(min,cur)}
}

let {min,max} =  pers.map(v=>v.born).reduce(minMax,{min : +Infinity,max : -Infinity});

console.log(` l'écart d'age est de ${max-min}`);

En action !