There are many things worth mentioning in that code.
1) This is a definition of a function which is called immediatly afterwards
(function(r, $, undefined){
// some stuff
})(window.Register= window.Register|| {}, jQuery);
2) Note that
window.Register= window.Register|| {}
is passed as a first argument. This means that window.Register
is set to window.Register
if it already exists (actually if it evaluates to boolean true, which is close enough) or to new object {}
otherwise. Since =
operator returns thing on the right side this entire syntax is a shortcut for:
if (!window.Register) {
window.Register = {};
}
(function(r, $, undefined){
// some stuff
})(window.Register, jQuery);
3) The function accepts 3 arguments, however 2 were passed. Therefore the last argument named undefined
will be undefined
(which is supposed to be a keyword but someone may override it).
4) As for this line
'use striction';
it's probably a mistake and it should be 'use strict';
. It tells interpreter to use more strict rules (helpful for avoiding for example accidental globals). Read this for more info:
What does "use strict" do in JavaScript, and what is the reasoning behind it?
5) The semicolon ;
in front is used because JavaScript allows to write code without semicolon in most but not all cases. In order to avoid potential errors putting a semicolon in front is necessary (assuming there actually is something in front of that code).
Hope it helps.