IIFE (Immediately Invoked Function Expression)
How can you make variables inside one IIFE accessible to another IIFE?
You can make variables inside one IIFE accessible to another IIFE by returning the variables and assigning them to a shared scope variable. While IIFEs do create their own isolated scope, they can communicate with the outer scope by returning values or by modifying variables that both IIFEs can access. A common pattern is to have both IIFEs assign their public interfaces to properties of the same object, creating a namespace. For example: ```javascript var namespace = {}; // First IIFE adds to namespace (function() { var privateVar = 'private'; namespace.method1 = function() { return privateVar; }; })(); // Second IIFE can use what first one exposed (function() { namespace.method2 = function() { return namespace.method1() + ' accessed'; }; })(); ``` This is one way modules were implemented before ES6 modules.