Would be really grateful for any help. Im pretty new to javascript and cant figure out how to solve this problem that I am having. Basically I have 2 arrays. One contains an object with an id value and a corresponding group value. The second array contains only the id. I would like to compare the ids of both the arrays and if they match I would like to extract the corresponding group value.
E.g.
a = [1,2,3,4,5];
b = [{1:group1},{2:group2},{3:group3}];
If id in a matches id in b then print out the id's group value
var a = [];
var b = [];
var c = {};
if (condition) {
c = {id:group}
b.push(c)
}
if (condition) {
a.push(id)
}
for (var i = 0; i < a.length; i++) {
//If id value in a exists in b, get id's corresponding group value from b
}