100xDevs-hkirat/Week-1-assignment

Expenditure-analysis.js only allows a specific name for Total Price spent in output

Ni-011 opened this issue · 1 comments

In JS easy question 2 expenditure analysis, it requires a specific property name for the total amount in output object that is 'totalSpent' but the question doesn't hint it, if you make the entire program right and name the property something else it yields error and all test cases are passed on using the name 'totalSpent' in the output price but this isn't mentioned in question which tells to use 'total_amount_spent'

Also, I feel the description of the question is not clear. After reading the description, I comprehended that the output list should be of the following form for this particular example (after seeing the line-> Output - [{ category1 - total_amount_spent_on_category1 }, { category2 - total_amount_spent_on_category2 }]) :
Ex: Input:
{
id: 1,
timestamp: 1656076800000,
price: 10,
category: 'Food',
itemName: 'Pizza',
},
{
id: 2,
timestamp: 1656259600000,
price: 20,
category: 'Food',
itemName: 'Burger',
},
{
id: 3,
timestamp: 1656019200000,
price: 15,
category: 'Clothing',
itemName: 'T-Shirt',
},
{
id: 4,
timestamp: 1656364800000,
price: 30,
category: 'Electronics',
itemName: 'Headphones',
},
{
id: 5,
timestamp: 1656105600000,
price: 25,
category: 'Clothing',
itemName: 'Jeans',
},

  Output:
  
  [{Food: 30}, {Clothing: 40}, {Electronics: 30}]