title: Equals and other methods for entity class in Node js
body: <p>I am new to Node js. So, I have some basic doubts more related to OOP. I have defined one object as </p>
  
  <pre><code>function Person(name, age, address) {
      this.name = name;
      this.age = age;
      this.address = address;
  }
  </code></pre>
  
  <p>Now, if I wanted to add methods for Person like equals(), hashCode(), etc., where can I do that?</p>
  
  <p>I am familiar with JAVA language and there when we used to define a POJO class, we also sometimes used to add methods which worked on that.</p>
  
  <p>Eventually, I wanted to do something like this</p>
  
  <pre><code>var p1 = new Person("person1", 18, "XYZ");
  var p2 = new Person("person1", 18, "XYZ");
  
  if(p1.equals(p2)) {
      .....
  }
  </code></pre>
  
  <p>How can I do that?</p>