Get the latest tech news
Immediately-Invoked Function Expression (2010)
hadn’t noticed, I’m a bit of a stickler for terminology. So, after hearing the popular, yet misleading, JavaScript term “self-executing anonymous function” (or self-invoked anonymous function) one too many times, I’ve finally decided to organize my thoughts into an article.
Note that in the last two examples, lockedInIndex could have just been called i without any issue, but using a differently named identifier as a function argument makes the concept significantly easier to explain. You’ve already seen it mentioned a few times, but in case it wasn’t clear, I’m proposing the term “ Immediately-Invoked Function Expression ”, and “ IIFE ” if you like acronyms. And as for my preferring “invoked” over “executed,” it’s a simple matter of alliteration; I think “ IIFE ” looks and sounds nicer than “IEFE.”
Or read this on Hacker News