title: What's the best way to create JavaScript classes?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/310870/use-of-prototype-vs-this-in-javascript">Use of ‘prototype’ vs. ‘this’ in Javascript?</a><br>
    <a href="https://stackoverflow.com/questions/444170/object-oriented-questions-in-javascript">Object Oriented questions in Javascript</a>  </p>
  </blockquote>
  
  
  
  <p>Can you please recommend which of the following is the best or their pros and cons?</p>
  
  <h3>Method 1</h3>
  
  <pre><code>function User() {
  
      this.name = "my name";
      this.save = function() {
  
      };
  }
  </code></pre>
  
  <h3>Method 2</h3>
  
  <pre><code>function User() {
  
      this.name = "my name";
  }
  
  User.prototype.save = function() {
  
  }
  </code></pre>