I have the following 3 items from the structure of data below:
- Let's assume that
grouphas three fields:id,name,accountNumberand because I have three items, two of them have the sameaccountNumber.
What i want to do
I want to write a function with javascript/es6 to loop through these objects, check the id and accountNumber in group and push that in a new array of objects named results.
(If any id contains the same accountnumber it should not be pushed to the new array below)
# new array
# results = [
{
id: 1,
accountNumber: 2289,
},
{
id: 2,
accountNumber: 9920,
},
]
Because of my background with python i am struggling to accomplish this. any help would be very helpful.
