If we define a function
(function(){
console.log("");
})();
then it is invoked immediately.
We could define the same function
function foo(){
console.log("");
}
foo();
I fail to see a good use case for this, but if there is one, then I don’t see why we not just define a normal function and call it. Why should we use immediately invoked functions and what are their advantages?