meaning of the last brakets
(function() {
....
})();
The ()
in the end causes the code inside the function to be executed immediately.
(function(param) {
....
})(JQuery);
The (JQuery)
in the end causes the code inside the function to be executed immediately, passing JQuery
as a parameter to it.
(function(chat, Friend) {
....
})(chat, chat.module("friend"));
The (chat, chat.module("friend"))
in the end causes the code inside the function to be executed immediately, passing chat
and chat.module("friend")
as parameters to it.