I need to subtract total amount - paid amount which is available.scheduleBudget - paidAmount.paid
const available = [
{ scheduleBudget: 21600, schudule_number: "11020" },
{ scheduleBudget: 1598000, schudule_number: "11010" },
];
const paidAmount = [
{ paid: 88488, schudule_number: "11010" },
{ paid: 7140, schudule_number: "11020" },
];
Expected output :
[
{ balance: 1509512, schudule_number: "11010" },
{ balance: 14460, schudule_number: "11020" },
];
code to get output
Object.values(available).forEach((key) => {
console.log(key);
});
availableorpaidAmounthave items that share a schudule_number within their respective lists? i.e. Could two of the items inavailablehave schudule_number 11020? Could two of the items inpaidAmounthave schudule_number 11020?