title: Is there any advantage or disadvantage to put JavaScript function into an object and call them when needed?
body: <p>For example I have bunch of functions like these:</p>
  
  <pre><code>function a() {
      //do something
  }
  
  function b() {
      //do something
  }
  //  call function a
  a();
  //  call function b
  b();
  </code></pre>
  
  <p>What advantage or disadvantage if I initialized the function this way?</p>
  
  <pre><code>var jslib = {
      a: {
          init: function() {
              //do something
          }
      },
      b: {
          init: function() {
              //do something
          }
      }
  }
  //  init function a
  jslib.a.init();
  //  init function b
  jslib.b.init();
  </code></pre>