was used as a module system before the introduction of , implemented using IIFE.
// โญ๏ธ object returned by IIFE
// โญก
// โญ โฎ โญโโโโโโโโโโโ โญ๏ธ IIFE โโโโโโโโโโโโโฎ
const foo = (function() {
// internal function
function sayHi(name) {
console.log(`Hey, my name is ${name}`);
}
// โญ๏ธ exposing the variables
return { sayHi };
})();
// โญ๏ธ accessing exposed methods
foo.sayHi("Bar");