Tell us what’s happening:
Lesson “ES6: Use the Rest Parameter with Function Parameters” had a huge gap in struction. The previous lesson was setting default values for a parameter. In the Rest Parameter lesson, we were expected to know how to use higher-order functions like filter, map and reduce, despite having no exposure to them. Was this intentional?
First-time coder so was very confused.
Your code so far
const sum = (...args) => {
return args.reduce(function(acc, num){
return acc + num
},0)
}
/*
const sum = (...args) => {
return args.reduce((a, b) => a + b, 0);
}
*/
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
.
Challenge: Use the Rest Parameter with Function Parameters
Link to the challenge: