(function () {
console.log("first");
$ = function (){
console.log("second");
}
})()
/*without the $= part in the other example, $() can be invoked outside the function*/
() => {
//some code
} () // without last scopes it's anonymous function
(function(){
// all your code here
alert("XXXXXX");
})();
/*this field executes immediates when it created*/