title: Check if an object exist in an array in Angular 6
body: <p>I have an array of categories: <code>this.categories</code></p>
  
  <pre><code>[ { "id": 6, "name": "categories.ladies_team" }, { "id": 2, "name": "categories.junior_team" }, { "id": 7, "name": "categories.master" }, { "id": 5, "name": "categories.ladies_single" }, { "id": 1, "name": "categories.junior" }, { "id": 3, "name": "categories.men_single" }, { "id": 4, "name": "categories.men_team" } ]
  </code></pre>
  
  <p>Now I have a new element: </p>
  
  <pre><code>const newCategory = {
      id: category.id,
      name: category.name
  };
  </code></pre>
  
  <p>I would like to insert it if not present.</p>
  
  <p>I tried: </p>
  
  <pre><code>if (!this.categories.includes(newCategory)) {
      this.categories.push(newCategory);
    }
  </code></pre>
  
  <p>but it is not working...</p>
  
  <p>What am I doing wrong ?</p>