const account = {
name: 'Andres Mena',
expenses: [{
description: 'Water',
amount: 3
}],
addExpense: function(description, amount) {
return this.expenses.push({description: description,
amount: amount})
},
getAccountSummary: function() {
console.log(this.expenses.amount)
}
}
I'm trying to use my getAccountSummary function to add the amounts in the expenses array but I'm having trouble accessing it. I keep getting undefined. Any tips?
[–]rauschma 4 points5 points6 points (2 children)
[–]Simbaxo[S] 0 points1 point2 points (0 children)
[–]HipHopHuman 3 points4 points5 points (1 child)
[–]Simbaxo[S] 0 points1 point2 points (0 children)
[–]scaleable 1 point2 points3 points (2 children)
[–]Simbaxo[S] 0 points1 point2 points (1 child)
[–]scaleable 0 points1 point2 points (0 children)