1function sum(...numbers) {
2 return numbers.reduce((accumulator, current) => {
3 return accumulator += current;
4 });
5};
6
7sum(1,2) // 3
8sum(1,2,3,4,5) // 15
1function addition(...nombre) {
2
3 let resultat = 0
4
5 nombre.forEach(nombre => {
6 resultat+= nombre ;
7 });
8
9 console.log(resultat) ;
10
11}
12
13addition(4 ,9 ,5 ,415 ,78 , 54) ;
1function multiply(multiplier, ...theArgs) {
2 return theArgs.map(element => {
3 return multiplier * element
4 })
5}
6
7let arr = multiply(2, 1, 2, 3)
8console.log(arr) // [2, 4, 6]
9