I'm facing a frustrating issue in Firebase where I am required to compare an object returned to me with an array.
I need assistance in completing this method:
const removeAlreadySeenUsersFromQueue = (newUsers, likedUsers) => {
}
The scenario is that newUsers is an array of objects, each containing an id of interest.
On the other hand, likedUsers is returning as an array of objects within objects, like so:
[{object1: {}, object2: {}, object3: {}]
, essentially an array of length one. Within each object, there exists an id key that I need to identify. My goal is to compare both arrays and return an array solely containing objects whose ids appear only in newUsers and not in likedUsers. I believe object.keys()
might be useful here, but my current attempts are unsuccessful
For example:
[{id: 4444}, {id: 5555}, {id: 6666}]
[{object1: {id: 4444}, object2: {id: 5555}, object3: {id: 121241}}]
After comparing these two arrays, I expect to receive just {id: 6666}
.