'Sum objects from array in JavaScript (JS)
I want to sum expense but i dont know how, can somebody explain
for (let i = 0; i < ExpensesList.length; i++) {
const expense = Number(ExpensesList[i][2])
console.log(expense);
}
ExpenseList:
0: ["First expense", "2022-02-05", "51"]
1: ["Second expense", "2022-02-05", "5"]
2: ["Third expense", "2022-02-12", "213"]
In console.log i have 51, 5, 213 sum of this is 269 but i dont know how to add that to each other
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
