I have an array of object like this :
array = [
   {x: 205, y: 205}
   {x: 230, y: 205}
   {x: 255, y: 205}
   {x: 205, y: 205}
   {x: 205, y: 205}
   {x: 205, y: 205}
]
I want check if my array contain the same object once( for example the 3 last objects are the same) so I want just delete them.
If I select or deselect a item , I just want the coordinates of the selected item in the array
    function selectFixture() {
      const item = new PIXI.Graphics();
      // check if place is empty
      if (this.isDown) {
        this.isDown = false;
        console.log(this.isDown)
        item.beginFill(colors[1]);
        item.drawRect(this.positionX, this.positionY, tileH, tileW);
        container.addChild(item);
        console.log(finalArray)
      } else {
        this.isDown = true;
        console.log(this.isDown)
        item.beginFill(colors[2]);
        item.drawRect(this.positionX, this.positionY, tileH, tileW);
        container.addChild(item);
        selectedFixtures.push({
          x: this.positionX,
          y: this.positionY,
        })
        console.log(selectedFixtures)
        var finalArray = {};
        for (var i = 0, len = selectedFixtures.length; i < len; i++)
          finalArray[selectedFixtures[i]['x']] = selectedFixtures[i];
        selectedFixtures = new Array();
        for (var key in finalArray)
          selectedFixtures.push(finalArray[key]);
        console.log(finalArray)
      }
    }
https://codepen.io/sebastiancz/pen/WNQLxaw
How can I do this ?
 
     
     
    