An array of js objects determines whether a particular attribute is duplicated.

the code is as follows

{
  a: 1,
  b: 21,
},
{
  a: 1,
  b: 21,
},

ask for your advice

Jan.19,2022

gets the same attribute name and value, for reference only:

function getCommonObj(arr,key,val){//arrkeyval
        var valArr = []//
        for(var i=0; i< arr.length; iPP){
            if(arr[i][key] == val){
                valArr.push(arr[i])//
        }
        }
        if(valArr.length>=2){
            return valArr
        }
}


you are not right

Menu