Use the Rest Operator with Function Parameters - Functions Question

Tell us what’s happening:
Version 1 has a function within a function, whereas version 2 only has one funtion. They both return the same values. I wanted to know what is the advantages/uses of version 1 over version 2?

Your code so far

Version 1


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

Version 2


function sum(...args) {
    return args.reduce((a, b) => a + b, 0);
  };

console.log(sum(1, 2, 3)); // 6

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-the-rest-operator-with-function-parameters