I have this array which is eewootags:
and I have another array evProductTag which is below:
I am trying to get the id which is common to both.
This is what I tried:
var tagdataexist = [];
for (var i = 0; i < evProductTag.length; i++) {
for (var j = 0; j < eewootags.length; j++) {
if (eewootags[j].name == evProductTag[i].name){
tagdataexist.push(eewootags[i].id);
}
}
}
console.log(tagdataexist);
But this gives be 193 instead of 187.
Tag2 is the common element by name.
Please help!


console.log(JSON.stringify(obj, null, 2))to get a string value you can then copy and paste. Please try to limit the amount of data to only enough to demonstrate the problem.