As someone who came from python, where the convention is to define a main function, this looks like the ugliest design pattern in the world. It never ceased to amaze me how this one has stuck around. Thank God for ES6 I guess..
Anyway great article with very clear examples!
Thanks Dor! I agree it can be a bit obtuse to look at. What always gets me is having to go to tail of the code to see what parameters were being passed in from outside the IIFE's scope.
I agree that ES6 has definitely made this cleaner and easier to understand with classes and imports. However, I was looking around briefly to see if ES6 modules are actually a syntactic sugar over this, but did not come up with anything yet.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.