I found some JavaScript syntax which is unknown for me and I even don't know how it's called or what it does so I can't find any documentation.
I found it on MDC Doc Center:
var Counter = (function() {
var privateCounter = 0;
function changeBy(val) {
privateCounter += val;
}
return {
increment: function() {
changeBy(1);
},
decrement: function() {
changeBy(-1);
},
value: function() {
return privateCounter;
}
}
})();
The part I am interested in is:
var Counter = (function() {})();
What the round brackets do? How this is called and where it can be used?