Javascript Algorithms and Data Structures - Cash Register

Hi, just want to check if the solution for the last test in this exercise is correct.

Solution given is:

{status: “CLOSED”, change: [[“PENNY”, 0.5], [“NICKEL”, 0], [“DIME”, 0], [“QUARTER”, 0], [“ONE”, 0], [“FIVE”, 0], [“TEN”, 0], [“TWENTY”, 0], [“ONE HUNDRED”, 0]]}

However, from the instructions, it seems the solution should be:

{ status: ‘OPEN’, change: [ [ ‘PENNY’, 0.5 ] ] }

Don’t know if I’m missing something… thank you for looking at this!

Sorry, just read the instructions again and saw what I was missing:

Return {status: "CLOSED", change: [...]} with cash-in-drawer as the value for the key change if it is equal to the change due

Did not really understand the instruction above previously. Get it now, and understand why the solution for the last test is given as it is.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.