title: How to avoid adding duplicate object in a list
body: <p>This is my model class</p>
  
  <pre><code>export class PersonModel {
  
      persCode:number;
      name:string;
      contactNumber:number;
      remarks:string;
    }
  </code></pre>
  
  <p>I'm having a list of objects of PersonModel</p>
  
  <pre><code>   affectedPersons: PersonModel[] = [];
  </code></pre>
  
  <p>How can I check whether an object is present in this list. So that I can avoid adding duplicate values.</p>
  
  <pre><code>addVisitor() {
          let visitorVal : PersonModel ;
          visitorVal = this.affectedPersons.filter(x =&gt; x.name == this.visitorName &amp;&amp; x.contactNumber== this.visitorMob &amp;&amp; x.remarks==this.visitorRemark, x =&gt; console.log("x "+ JSON.stringify(x)))
              .map(x =&gt; x)[0];
  
          }
  </code></pre>
  
  <p>This is not working. How can I achieve this</p>