Tell us what’s happening:
The last test, The sum function uses the ... spread operator on the args parameter.
is failing even though sum
indeed uses spread operator.
Any thoughts?
Your code so far
const sum = (...args) => !args.length ? 0 : args.reduce((a, b) => a + b);
console.log(sum(1, 2, 3)); // 6
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-the-rest-operator-with-function-parameters