Javascript project cash register return format question

What exactly are the proper specifications for output? In the third test, nickels are not listed in the array. It also worth noting there are none in the change returned. Is it supposed to be that way? If so, I will need help removing that section from my return statement.

Summary

checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]) should return {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}

In the last test, the output is in a exact opposite order from the above. I suppose that has to do with sorting the change array.

Summary

checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return {status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]}

The question states it but it can be a bit confusing.

If the cash register has exact change, you return an array of the entire drawer (your summary #2 above) and status closed.

If the cash register has more than enough change, you return an array of the exact change and in what denominations it was returned with the status open.

1 Like

Also, in the given example, using everything down to dimes gets you to $96.70 - so nickels would not be in the return array (or would return pointlessly, with a value of 0.00).

However, the order of the returned results don’t really matter, so long as the proper “keys” are in place, i.e., the currency names. Personally, I started from largest to smallest, then simply unshifted values onto the array I was returning, thus returning the smallest-to-largest order. Why? I don’t know. Could have pushed rather than unshifted, but there it is