JS - IIFE

by Charlie Winfrey

JavaScript

var tasksController = function() {
    
    var myVariable = 5;
    
    return {
        myVariable: myVariable   
    }
    
}(); // there it is!

console.log(tasksController);

// This, however, will not work
// The function statement must be wrapped in () to make it an expression
/*function namedController() {
     
}();*/