Javascript anonymous function

by 0 replies
0
Hello,

I'm learn js and every time I see this convention:

Code:
(function(){
  // do something
})();
For what I need use anonymouse function?
I mean, I can do something like that:

Code:
document.getElementById('someid').innerHTML = 123;
Without anonymouse function, and in tutorials I see its used inside anonymous function.
#website design #anonymous #function #javascript

Next Topics on Trending Feed