title: JavaScript two objects - overriding each other
body: <p>I am trying to learn Object Oriented Programming in JavaScript. Therefore, I may be wrong in what I am doing.</p>
  
  <p>I have one JS function (class):</p>
  
  <pre><code>function User() {
      //initiating object code goes here
  }
  
  //Functions
  User.prototype.getEmpId = function() {
      return this.empId;
  }
  
  var myUser = new User({'empid':'1'});
  
  console.log(myUser.getEmpId()); //Returns 1
  
  var mynewuser = new User({'empid':'2'});
  
  console.log(myUser.getEmpId()); //Returns 2
  
  console.log(mynewuser.getEmpId()); //Returns 2
  </code></pre>
  
  <p>I don't understand what is going wrong here. If these two are two different objects then why is it causing problem. I have added the complete code <a href="http://jsfiddle.net/srivastaveer/dg1negkb/1/" rel="nofollow">here</a>.</p>
  
  <p>Thanks in advance.</p>