Understanding the IIFE in ES6: Use Destructuring Assignment to Assign Variables from Arrays

Hello,
Could someone help me understand why a IIFE is used in The destructuring assignment to assign variables from arrays lesson? I finished the lesson and I’ve read through some of the links explaining IIFEs, but the purpose/benefit of using it in this application is not really clicking. TIA

That was my confusion.

I agree, it seems like they buried the actual problem in unnecessary layers in the code.

Am I missing some lesson they’re trying to impart? Or functionality that is possible by doing it the way the code stub sets it up?

Just don’t use ‘const’

[a, b] = [b, a];
2 Likes