Calculate totals and find the largest expense from object arrays.
Given a list of expenses, calculate useful totals and identify the largest expense. The final summary should reuse the smaller helper functions.
Write these functions:
calculateTotal(expenses) should return the total amount spent.
calculateCategoryTotal(expenses, category) should return the total for one category.
findLargestExpense(expenses) should return the full expense object with the largest amount.
createExpenseSummary(expenses) should return total, foodTotal, transportTotal, and largestExpense.
Sample checks:
Expected output:
findLargestExpense should return the whole expense object, not only the amount.
Join the Community
roadmap.sh is the most starred project on GitHub and is visited by hundreds of thousands of developers every month.
Roadmaps Best Practices Guides Videos FAQs YouTube
roadmap.sh by @kamrify @kamrify
Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.
Login or Signup
You must be logged in to perform this action.