This is definitely a valid use case for it. I guess the only problem you'll ever face with this approach is readability. At first glance, it isn't really a design pattern you see often. Moreover, the algorithm isn't as straightforward as one may think. Perhaps sprinkling a few comments here and there explaining your rationale and thought processes will help. Other than that, I see nothing wrong with this. 🙂
That's because it's an anti-pattern. This is not a valid use case.
An IIFE is still common. It's often used in browser
content extensions or snippets loaded from providers (analytics, ads, ...), because the browser's scope is shared by all active snippets, so we limit the scope.
Well, there's that, too. 😅
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.