Area 73 Blog

this is a description of my new blog created with Gatsbyjs


    Blog Post
    patterns/mixins / patterns/testing-prototype-inheritance

    IIFE - Inmediatelly Invoked Function Expression

        var foo = "foo1";
    
        (function() {
            var foo = "foo2";
            console.log(foo);  // foo2
        })();
    
    
        console.log(foo); // foo1
    
        // we can also write the above statement like:
        (function() {
            // code
        }());

    We use IIFE in order to not pollute the global scope.

    Bibliography: <br/ > Ben Alman: Immediately-Invoked Function Expression (IIFE)