I have two sets of data represented by objects object_a
and object_b
. I want to extract the items from object_a
that correspond to the IDs found in object_b
.
const object_a = {
100: "Stack Overflow",
101: "MDN Web Docks",
102: "Javascript"
}
const object_b = {
0: {
id: 100,
name: "Stack",
lastname: "Overflow"
},
1: {
id: 101,
name: "Web",
lastname: "Docks"
}
}
My goal is to create a new object containing the items from object_a
whose IDs are present in object_b
.
const desired_object = {
100: "Stack Overflow",
101: "MDN Web Docks"
}