title: find duplicate before pushing new values
body: <p>I need to know the best method to check if the value is in the array before push it</p>
  
  <p>I have an array :</p>
  
  <pre><code>coordinates: [
       {x: 160, y: 160},
       {x: 192, y: 160},
       {x: 224, y: 160},
       {x: 224, y: 192},
       ];
  </code></pre>
  
  <p>For each call of my function , I need to check if new coordinates is it before proceed to push.</p>
  
  <pre><code>const payload= {x: 224, y: 190}
  
  //Next function call 
  
  const payload = {x: 224, y: 190}   // need to refuse pushing this value
  </code></pre>
  
  <p>I tried filter and other JS methods without success.</p>
  
  <p>for example:</p>
  
  <pre><code>coordinates.filter(c =&gt; {if(payload !== c){coordinates.push(new)});
  
  </code></pre>
  
  <p>This one doesn't work for me .</p>