The difference is that if you do not use an IIFE, the functions (or mixins as described on that page) are created in the global scope.

i.e. after you declare them, you can access them via:

window.isCuteMixin()

This is considered bad practice as you can run into issues with naming collisions, for example if you’re working in a team and someone else creates a function with the same name (isCuteMixin) - you’ll hear people refer to this as “polluting the global scope”.

Declaring them instead inside the IIFE means they are ONLY accessible from the object that was assigned the return value of the IIFE.

In that example, motionModule can now use the 2 functions, e.g. motionModule.glideMixin(), but if you tried window.glideMixin() you would get undefined because the functions were not created in the scope of window.

Oh, additionally it makes it much easier to work with your code, especially as your project gets bigger and bigger. Knowing that you can just go to motionModule for all your motion related functions, or userModule for all functions related to managing a user makes it much easier to maintain.