title: How to initialize an object in javascript?
body: <p>I would like to initialize an object in javascript..</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>var PageSlider = {
  
      sliders: [],
  
      addSlider: function(display, target, itemClass, width, height, itemsPerPage, defaultPage){
          var slideConfig = {
                  display : display,
                  target : target
          };
          var slider = this.createSlider(slideConfig);
          slider.initSlider();
          this.sliders.push(slider);
  
      },
  
      copy : function(obj) {
          if (null == obj || "object" != typeof obj) return obj;
          var copy = obj.constructor();
          for (var attr in obj) {
              if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
          }
          return copy;
      },
  
      getInstance : function(){
          var copy = PageSlider.copy(PageSlider);
          this.sliders.length = 0;
          return copy;
      }
  
  }
  </code></pre>
  
  <p>Using the getInstance() method just copy the object.
  What i need to do is to get the instance of the object.</p>
  
  <p>Help please. Thank you.</p>