title: Difference between a class and an object in Javascript
body: <p>What's the difference between </p>
  
  <pre><code>var myView = function () {
  //something goes here
  };
  </code></pre>
  
  <p>and </p>
  
  <pre><code>var myView = function () {
  //something goes here
      return {
          a: x,
          b: y
  }();
  </code></pre>
  
  <p>I think the first snippet creates a "dynamic" class, so that you can say</p>
  
  <pre><code>var anotherView = new myView();
  </code></pre>
  
  <p>and the second snippet is similar to a singleton "dynamic" object, but I'm not very sure.</p>