I hold all the expenses data in a JS Object as shown...
var transactions = {
"date": "1-1-2023",
"amount": "850",
"name": "rent",
"category": "housing",
"notepad": ""
},
{
"date": "1-1-2023",
"amount": "91",
"name": "electric",
"category": "housing",
"notepad": ""
},
{
"date": "1-1-2023",
"amount": "gas",
"name": "83",
"category": "housing",
"notepad": ""
},
{
"date": "1-1-2023",
"amount": "50",
"name": "car insurance",
"category": "transportation",
"notepad": ""
}
How can I calculate and all all the money together spent in housing and put it in an array (same with the other categories)?
The goal is to have something like ...
var groups = ['housing', 'transportation']
var expenses = ['1000', '50']