I am playing around with HTML5 and javascript and have found a file called
Quote:
Hand.js: a polyfill for supporting pointer events on every browser
|
Being a linuxian, I am naturally curious how the code works. I have encountered at the beginning of the file this bit of voodo:
Code:
var HANDJS = HANDJS || {};
(function () {
// Code to the end of the file
})();
Can someone explain to me how these lines work and what they do?
It is seemingly a function enclosed in parentheses followed by parentheses. Why?
What is that weird name: function()? Shouldn't function be a reserved name?
I presume that the first line puts true or false into the var HANDJS so that the file is not loaded twice.