The same filter array of values

const arr = [{x: 12 , y: 12}, {x: 123, y: 123}, {x: 124, y: 124}, {x: 12, y: 12}]; // original array, If the same test returns to true 



        for (the let I = 0; I <arr.length; I ++) { 

          const = Current ARR [I]; // such as: {X: 12 is, Y: 12 is} 

          // array which determines whether What is the current value of the same item, 

          the let filterArr = arr.filter (item => item.x === === current.x && item.y current.y); 

          IF (filterArr.length>. 1) {// negative current itself, it is 1, greater than 1 indicates that the same item 

            return to true; 

          } 

        }

  

Guess you like

Origin www.cnblogs.com/wangliko/p/12059086.html