Can someone explain the following piece of Javascript code?
<p>I was reading <a href="http://stackoverflow.com/questions/10362956/encapsulation-in-javascript-module-pattern">another question</a>, and I saw this:</p>

<pre><code>var basketModule = (function() {
var basket = []; //private

return { //exposed to public
       addItem: function(values) {
            basket.push(values);
        },
        getItemCount: function() {
            return basket.length;
        },
        getTotal: function(){
            var q = this.getItemCount(),p=0;
            while(q--){
                p+= basket[q].price;
            }
        return p;
        }
      }
}());
</code></pre>

<p>Can you please explain why does he wrap the function in <code>( and )</code>'s? Also, what is the purpose of that <code>return</code>? Couldn't he just write <code>self.addItem = ...</code> and so on?</p>
