Q1 : Is this chain function exactly the same function with the parent one?
Q2 : The arguments are passed to parent function but it doesn’t has any parameter while chain function has rest operator ?
const sum = (function() {
"use strict";
return function sum(...args) {
return args.reduce((a, b) => a + b, 0);
};
})();
console.log(sum(1, 2, 3));