IIFE, or an immediately-invoked function expression, is something that’s been a relatively common way of writing code in JavaScript.
It’s something that I think anyone doing any type of client-side development with WordPress should be using, but first I think it’s important to grasp the concept. Wikipedia provides a definition of IIFE:
An immediately-invoked function expression (or IIFE, pronounced “iffy) is a JavaScript programming language idiom which produces a lexical scope using JavaScript’s function scoping.
If you’re new to JavaScript, that just sounds kind of intense, right? So perhaps a better definition might be:
An “iffy” defines how variable names are related to the functions in which they are contained. Inner functions maintain the scope of their parent functions.
And finally, these functions are invoked anonymously because the function that fires literally has no name. It’s fired when the browser loads, parses, and runs the script.
So how does this all relate to WordPress?