EX1
let max = arr.reduce(function(a,c) { return (a.length> c.length)?a:c;});EX2
EX3
let calcul = function (rayon) {
const PI = 3.14;
let perimetre = 2*PI*rayon,
volume = 4/3*PI*Math.pow(rayon,3),
diametre = rayon+rayon;
return {perimetre,volume,diametre};
};
let {perimetre,volume} = calcul(val);EX4
function foo ( ...args ) {
args = args.filter( v => v % 2 == 0);
console.log( args );
}
EX5
console.log(amis.reduce(function(prev, curr) {
return [...prev, ...curr.prenoms];
},[]););