Use the Spread Operator to Evaluate Arrays In-Place syntax problem?

Tell us what’s happening:

Why do the first and second codes work and the third does not? As far as I know, the third code complies with the syntax of the Arrow Functions. The first one has a normal JavaScript function. The second one has an arrow function (ES6) and the third one also, so I don’t understand why it fails.

The second has this line of code that I don’t know why it goes there [ })(); ]. The third one doesn’t have it because I understand it doesn’t put.

I appreciate your help.

Your code so far

const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
(function() {
  "use strict";
  arr2 = [...arr1]; // change this line

const otherArr1 = ['JAN2', 'FEB2', 'MAR2', 'APR2', 'MAY2'];
let otherArr2;
(() => {
  "use strict";
  otherArr2 = [...otherArr1]; // change this line

const myArr1 = ['JAN1', 'FEB1', 'MAR1', 'APR1', 'MAY1'];
let myArr2;
() => {
  "use strict";
  myArr2 = [...myArr1]; // change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.

Link to the challenge:

in your third code, the copying of the array is done inside a function, but as the function it is not called, it is not being executed.

when you have the parenthesis right after the function body it is an immediately invoked function expression, the function is executed in place
(instead of storing the function in a variable and then calling the function as myFunc())