I have two arrays, two arrays that loop through and truncate the labelID:4 in one array that is different from the id in the other.

I have two arrays, two arrays loop through, truncating the labelID:4 in one array and the id in the other array

 var select = [{
    labelID:4,
},{
    labelID:5
},{
    labelID:7,
}];

var  publishedLabel = [{
           active : true
        createTime : null
        creatorID : 0
        high : 0
        id : 1
        low : 0
        modifierID : 0
        modifyTime : null
        name : ""
        sort : 0
        status : 0
        type :0
       },{
           active : true
        createTime : null
        creatorID : 0
        high : 0
        id : 2
        low : 0
        modifierID : 0
        modifyTime : null
        name : ""
        sort : 0
        status : 0
        type :0
       },{
           active : true
        createTime : null
        creatorID : 0
        high : 0
        id : 3
        low : 0
        modifierID : 0
        modifyTime : null
        name : ""
        sort : 0
        status : 0
        type :0
       },{
           active : true
        createTime : null
        creatorID : 0
        high : 0
        id : 4
        low : 0
        modifierID : 0
        modifyTime : null
        name : ""
        sort : 0
        status : 0
        type :0
       },{
           active : true
        createTime : null
        creatorID : 0
        high : 0
        id : 5
        low : 0
        modifierID : 0
        modifyTime : null
        name : ""
        sort : 0
        status : 0
        type :0
       },{
           active : true
        createTime : null
        creatorID : 0
        high : 0
        id : 6
        low : 0
        modifierID : 0
        modifyTime : null
        name : ""
        sort : 0
        status : 0
        type :0
       },]


are these two arrays, which are truncated through a loop. The description of the-sharp-sharp-sharp problem that is different between labelID in select and id in publishedLabel

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Mar.08,2022

problem description is not clear


function filter() {
    const ids = new Set(select.map(m => m.labelID));
    return publishedLabel.filter(m => !ids.has(m.id));
}
console.log(filter());

if neither of these two guesses your intentions, you'd better make the problem clear first.

Menu