It’s a bug in this exercise. This code will work fine.
const sum = (function() {
"use strict";
return function sum(...args) {
return args.reduce((a, b) => a + b, 0);
};
})();
I don’t know why it’s defined as a return function in an IIFE. As it is beyond the scope of current challenge. And you also can’t call the arguments ...nums, it will error out. You have to pass them as ...args. Again, it’s a bug in this exercise. Your code is fine though.
Because the challenge is testing the code you’ve written, not just the output (if it didn’t you could pass all the tests without using any of the features FCC is trying to teach), it has to match the description pretty closely, you generally can’t change things like variable names.
It’s only on the algorithm and project sections that you have free reign.