Tell us what’s happening:
Your code so far
const sum = (function() {
"use strict";
return function sum(...args) {
// const args = [ x, y, z ];
return args.reduce((a, b) => a + b, 0); };
})();
console.log(sum(1, 2, 3, 4, 5));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascriptalgorithmsanddatastructures/es6/usetherestoperatorwithfunctionparameters
I have some very basic level question about this.
I’m not sure what have I been missing out so far.

// const args = [ x, y, z ];
why should this part be omitted?
My guess is because …args create an array called args,
an array called args shouldn’t already exist. is that right?  I don’t understand what
()
at the very end of the code stand for.
const sum = (function() {
} ) ();
so i have a question about what these curly braces
that wraps around the whole code block stands for,
and why is it inside of const sum = (function() {codes} )
and what is this (); at the end.
I feel like I missed some important lessons about structures of codes…
what lesson should i review ?
Thanks.