Can someone help me - whats wrong with the code?

Tell us what’s happening:

Your code so far

const sum = (...args) => {
let sumi = 0;
for (let i = 0; i < args.length; i++){
  sumi = sumi + args(i);
return sumi;

console.log(sum(1, 2, 3)); // 6

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

you have change too much stuff

you just needed to make sure that the provided code would work wth any number of arguments, not change the whole code to something else

I suggest you reset your code and try again
leave the return statement alone this time


This is your issue. What’s the syntax for accessing elements of an array?

1 Like

Thanks man ! :slight_smile: ! Understood my mistake.