JavaScript Help and Explanation
<p>Me and a friend were working on a site.  I had him do the JavaScript as I am not really familiar with JavaScript.</p>

<p>He has since moved away and I am looking at a piece of JavaScript code that I do not really understand.  I know what the logic is doing but the structure of the code is unfamiliar to me, I know JavaScript has a lack of proper OO but can't get my head around this.</p>

<p>Could anyone have a look and explanation of why it is coded the way it is.</p>

<pre><code>var skillQueue = (function () {
    "use strict";

        queueList = [],
        totalQueueLength = 0,
        isNumber;
        var skillQueue = {},

    isNumber = function (val) {
        return typeof val === 'number';
    };

    skillQueue.removeQueue = function (val) {
        if (arguments.length !== 1 || !isNumber(val) ) {
            throw new Error("Unable to remove skill from queue");
        }

        queueList.push("-" + val);
        totalQueueLength = totalQueueLength - val;
    };

    skillQueue.showQueue = function () {
        return queueList;
    };

    skillQueue.getQueueLength = function () {
        return totalQueueLength;    
    };

    skillQueue.add = function (val) {
        if (arguments.length !== 1 || !isNumber(val) ) {
            throw new Error("Unable to add skill to queue");
        }

        queueList.push("+" + val);
        totalQueueLength = totalQueueLength + val;
    };

    return skillQueue;
}());
</code></pre>

<p>Cheers</p>
