var basketModule = (function() {
  var basket = [];
    return {
        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;
        }
    }
}());

@@ -26,16 +26,32 @@
 ion() %7B%0A
+  // privates%0A %0A
   var ba
@@ -62,17 +62,165 @@
  = %5B%5D;%0A 
+%0A
  
+ function doSomethingPrivate() %7B%0A    //...%0A  %7D%0A %0A  function doSomethingElsePrivate() %7B%0A    //...%0A  %7D%0A %0A  // Return an object exposed to the public%0A
   return
@@ -219,27 +219,56 @@
   return %7B%0A 
+%0A
    
+ // Add items to our basket%0A
     addItem:
@@ -293,22 +293,16 @@
 %7B%0A      
-   
-   
 basket.p
@@ -314,35 +314,73 @@
 alues);%0A    
-    %7D,%0A    
+%7D,%0A %0A    // Get the count of items in the basket%0A
     getItemC
@@ -400,30 +400,24 @@
 n() %7B%0A      
-  
-    
 return baske
@@ -434,19 +434,144 @@
     
-    %7D,%0A    
+%7D,%0A %0A    // Public alias to a private function%0A    doSomething: doSomethingPrivate,%0A %0A    // Get the total value of items in the basket%0A
     
@@ -599,21 +599,16 @@
 %7B%0A      
-     
 var q = 
@@ -630,20 +630,16 @@
 nt()
-,p=0
 ;%0A      
     
@@ -634,22 +634,35 @@
 ;%0A      
- 
+var p = 0;%0A %0A
      
+ 
 while(q-
@@ -663,16 +663,17 @@
 ile(q--)
+ 
 %7B%0A      
@@ -678,17 +678,10 @@
     
-        
 p
+ 
 += b
@@ -699,64 +699,693 @@
 ice;
- %0A            %7D%0A            return p;%0A        %7D%0A    %7D%0A%7D()
+%0A      %7D%0A %0A      return p;%0A    %7D%0A  %7D;%0A%7D)();%0A%0A// Usage:%0A%0A// basketModule returns an object with a public API we can use%0A %0AbasketModule.addItem(%7B%0A  item: %22bread%22,%0A  price: 0.5%0A%7D);%0A %0AbasketModule.addItem(%7B%0A  item: %22butter%22,%0A  price: 0.3%0A%7D);%0A %0A// Outputs: 2%0Aconsole.log(basketModule.getItemCount());%0A %0A// Outputs: 0.8%0Aconsole.log(basketModule.getTotal());%0A %0A// However, the following will not work:%0A %0A// Outputs: undefined%0A// This is because the basket itself is not exposed as a part of our%0A// the public API%0Aconsole.log(basketModule.basket);%0A %0A// This also won't work as it only exists within the scope of our%0A// basketModule closure, but not the returned public object%0Aconsole.log(basket
 );%0A

Extend module pattern description