Assignment
Create a personal budget tracker that:
- Creates an array of expense objects, each with:
description(string)amount(number)category(string: 'Food', 'Transport', 'Entertainment', 'Bills', etc.)date(string)
- Creates a function called
calculateTotalExpensesthat:- Takes an array of expenses as parameter
- Returns the total amount
- Creates a function called
getExpensesByCategorythat:- Takes an array of expenses and a category string as parameters
- Returns the total amount spent in that category
- Creates a function called
getHighestExpensethat:- Takes an array of expenses as parameter
- Returns the expense object with the highest amount
- Displays all expenses using
forEach - Displays the total expenses
- Displays expenses by category
- Displays the highest expense
Requirements:
- Use arrays of objects
- Use functions with parameters and return values
- Use forEach, for loops, and comparison operators
- Use template literals for formatting
- Use an external JavaScript file (script.js) linked to your HTML
Create an index.html file and a script.js file with your solution.