I have an array of JS objects like this in a file called expenses.js
var expenses =
[
{
day: "9/11/2019", expenses: {
pen: 15,
tea: 32,
auto: 40,
juice: 30,
}
},
{
day: "10/11/2019", expenses: {
bananas: 50,
auto: 100,
tea: 30,
}
}
]
Is is possible to have a function like addExpenses({day: "11/11/2019", expenses: {biscuit: 20}) in another JS file, called add-expense.js, that would add an object to the array of objects in expenses.js?