I’ve been learning about the spread operator. I cannot find anywhere why this function is in parentheses.
Can some one explain this to me?
const arr1 = ["JAN", "FEB", "MAR", "APR", "MAY"];
let arr2;
(function () {
arr2 = [...arr1];
arr1[0] = "potato";
})();
console.log(arr2);
console.log(arr1);
Thanks