I came across something like this while I was looking at preexisting JavaScript
code. So I tried to write similar code and it worked correctly (or rather I don't know if its working correctly or not)
The code is like this
//main.js
(function() {
alert("am I being called?");
})();
I included this main.js in my index.html and as soon as I refreshed the page, the alert popped up.
What is this?
and what JavaScript concepts/features do I need to study to correctly understand this?