Stuck with Use the Rest Parameter with Function Parameters

Tell us what’s happening:
Hi guys, my code seems working, but the " The sum function should use the ... rest parameter on the args parameter." is not reached. I don’t understand why it’s wrong as I did use …args as parameters for the sum function…thanks for your help

Your code so far

function sum(...args){
let somme = 0;
for (var i = args.length - 1; i >= 0; i--){
  somme += args[i];
return somme;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

yes, but you also changed everything else in the function.
Doing what’s not required makes the tests fail.

Please reset, and just do as required.

Ohhh thanks, they haven’t talked about the .reduce fonction so I thought it would not work this easily. Thank you

1 Like