const arr = [{x: 12, y: 12},{x: 123, y: 123},{x: 124, y: 124},{x: 12, y: 12}];//原数组,如果有相同的测返回true
        for (let i = 0; i < arr.length; i++) {
          const current = arr[i];  //如: {x: 12, y: 12}
          //判断数组里面是否有何current值相同的项,
          let filterArr = arr.filter(item => item.x === current.x && item.y === current.y);
          if(filterArr.length > 1) { // 排除current本身,所以是1 ,大于1则表示有相同的项
            return true;
          }
        }
原文:https://www.cnblogs.com/wangliko/p/12059086.html