ES6: Use the Rest Operator with Function Parameters problem

Here is my code:

const sum = (function() {
  "use strict";
  return function sum(...args) {
     args = [ x, y, z ];
    return args.reduce((a, b) => a + b, 0);
  };
})();
console.log(sum(1, 2, 3)); // 6

I get errrors:

x is not defined

x is not defined

x is not defined

x is not defined

x is not defined

OK, I solved the exercise.

1 Like