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

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

#1

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


#2

Not really sure, because if you remove the IIFE and just write the code to swap the variable values using destructuring assignment, it still passes the tests.


#3

That was my confusion.


#4

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?