title: Difference between defining classes in different ways in JavaScript
body: <p>What is the difference between defining classed in the following ways?</p>
  
  <p>1)</p>
  
  <pre><code>var parentCls = {
      name:'John',
      callMe : function (){
          alert('Method gets called');
      }
  }
  parentCls.callMe();
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>function parentCls(){
      this.name='John';
      this.callMe = function (){
          alert('Method gets called');
      }
  }
  parentCls.CallMe()
  </code></pre>
  
  <p>Thanks</p>