Hitting a wall where there are two nested arrays and want to loop through the first array and compare every nested array to every nested array in the other array. If there is a match copy array to a 3rd array. Example:
var bills = [
["1/1/2013","Bill",0,0,"Fake Management","Management Fee","","$750.00",0,0,"$19,148.85"],
["1/1/2013","Bill",0,0,"Fake Edison","Electric PLP","","$1,208.37",0,0,"$20,357.22"],
["1/1/2013","Bill",0,0,"Fake Elevator","Monthly Elevator Maintenance January","","$1,055.27",0,0,"$21,412.49"],
["1/2/2013","Bill",0,0,"Fake Rug Repair Service","5 Floor, wall to wall carpet","","$375.00",0,0,"$21,787.49"],
];
var payments = [
["1/3/2013","Check EFT",0,0,"Carlos ","Weekly Cleaning","$375.00","",0,0,"$21,124.29"],
["1/4/2013","Check 126",0,0,"Fake Edison","25-2658-0826-0000-8 - Electric PLP","$1,208.37","",0,0,"$19,915.92"],
["1/4/2013","Check 128",0,0,"Fake Rug Repair Service","5 Floor, wall to wall carpet","$375.00","",0,0,"$19,540.92"],
["1/4/2013","Check 129",0,0,"Fake Group Companies","CUC-7001484-02-01 - Insurance First Payment","$260.50","",0,0,"$19,280.42"],
];
var paid = [];
var unpaid = [];
Here is the Pseudo code of what I'm trying to do:
for(var i = 0; i < bills.length; i++) {
if (bills[i][5] ==== AN ARRAY[5] INSIDE payments)
paid.push(bills[i])
} else {
unpaid.push(bills[i])
}
}
"AN ARRAY[5] INSIDE payments" is pure pseudocode and would be helpful if it could be translated into JS. I'm thinking that each bills array would need to loop through every payments array but the logic of how to implement is evading me.