I'm relatively new to JavaScript, I'm currently studying it and I came to this kind of code with self-executing functions.
Here is the first one:
(function(message){
var myMessage = message;
alert(myMessage);
})("hello");
Here is the second:
(function(message){
var myMessage = message;
alert(myMessage);
}("hello"));
Both of them work correctly but I'm just wondering what's the difference between the two and when should I use one over the other.
Sir/Ma'am your answers would be of great help. Thank you++