I want to return one element of an object, that is not contained in an array
I have the following array for example:
var aArray = [{ABC: { BADGE: "ABC" }}, {BCA: { BADGE: "BCA"}}]
And the following object:
var oObject = {
A: {
ABC: "ABC",
BCA: "BCA"
},
B: {
BCA: "BCA",
AAA: "AAA"
}
}
so what I would expect is to get AAA
currently I 'm struggling with the following code:
for(var j = 0; j < aArray.length; j++) {
bNotFound = true;
for(var biz in oObject) {
for(var badge in oObject[biz]) {
if(badge == aArray[j].BADGE) {
bNotFound == false;
}
}
}
if(bNotFound) {
// Return Badge
}
}
This would work - however I don't know which element to return at the // Return Badge position, cause I only know, that no element was found.
Any suggestions?
UPDATE:
Desired output:
{AAA: "AAA"}
{ }are not balanced.