What does the following code mean in JavaScript :
(function() {
})();
What does the following code mean in JavaScript :
(function() {
})();
Thats a singleton/IIFE (immediately invoked function expression).
Using an IIFE can be helpful when wanting to use a local scope which eliminates binding to global objects like the window.
There is also a slight performance benefit to this approach as you can pass in commonly used objects to the anonymous function. JavaScript first looks for a property in its local scope then works up the chain.
It is a Self-Invoking Anonymous Function.
A self-invoking anonymous runs automatically/immediately when you create it and has no name, hence called anonymous.