1 reassemble two arrays using double loops
2 condition
/ / 1. Compare the two arrays of Arr1,Arr2 and return a new array resultArr
/ / 2. ResultArr contains all the items in Arr2
/ / 3. If the project id in resultArr exists
/ / in Arr1 and its level is greater than level
/ / in resultArr project, its active familiar value is true, otherwise it is false
const myStacks = [{
id: 1,
name: "JavaScript",
level: 2,
},{
id: 2,
name: "CSS",
level: 1,
},{
id: 4,
name: "JQuery",
level: 1,
}]
const jobStacks = [{
id: 1,
name: "JavaScript",
level: 1,
},{
id: 2,
name: "CSS",
level: 3,
},{
id: 3,
name: "HTML",
level: 2,
}]
3. The result returns
//
[{
id: 1,
name: "JavaScript",
level: 1,
active: true
},{
id: 2,
name: "CSS",
level: 3,
active: false
},{
id: 3,
name: "HTML",
level: 2,
active: false
}]