steveosoule
10/10/2014 - 5:11 PM

Javascript Module Pattern

Javascript Module Pattern

// FROM: http://www.thinkful.com/learn/javascript-best-practices-1/Avoid-Globals

module = function(){
   var current = null;
   var labels = {
      'home':'home',
      'articles':'articles',
      'contact':'contact'
   };
   var init = function(){
   };
   var show = function(){
      current = 1;
   };
   var hide = function(){
      show();
   }
   return{init:init, show:show, current:current}
}();
module.init();