Alright, so I have three arrays with about 65k objects in each in node.js. They all share an ID - PARCELID, SBL, and SBL20 are the same. I want to combine the objects from the different arrays into a single object that is then pushed into the final array. For whatever reason, the output I get contains 130k+ objects. This is also pretty inefficient so if there is a better way to do this, I am all ears - I have attempted to use map() though I was only able to compare two arrays, not three. I have a fourth I would like to add into the mix as well.
var final = new Array();
count=0
TaxParcels.forEach((TaxParcel) => {
TaxBills.forEach((TaxBill) => {
if (TaxParcel.PARCELID == TaxBill.SBL20) {
CodeEnforcements.forEach((CodeEnforcement) => {
if (TaxParcel.PARCELID == CodeEnforcement.SBL) {
parcel = {
ID: TaxParcel.PARCELID,
DETAILS: {
TaxParcel: TaxParcel,
TaxBill: TaxBill,
CodeEnforcement: CodeEnforcement,
},
};
final.push(parcel);
count++
}
});
}
});
});
console.log(final);
console.log(count)