ES6 - Use the Rest Parameter with Function Parameters

Tell us what’s happening:

Describe your issue in detail here.
trying to figure out why my code isn’t passing the mark

Your code so far

const sum = (…alphabets) => {

let total = 0;
for (let i = 0; i < alphabets.length; i++) {
total += alphabets[i];
}
return total;
}

const sum = (...alphabets) => {
  
  let total = 0;
  for (let i = 0; i < alphabets.length; i++) {
    total += alphabets[i];
  }
  return total;
}

Your browser information:

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

Challenge Information:

ES6 - Use the Rest Parameter with Function Parameters

sum should be an arrow function which uses the rest parameter syntax (...) on the args parameter.

You used a different name than what the tests want.

wow! Thank you Jeremy :raised_hands:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.