# Error in Test for JavaScript Algorithms and Data Structures Projects: Cash Register

**URL:** <https://forum.freecodecamp.org/t/error-in-test-for-javascript-algorithms-and-data-structures-projects-cash-register/458997>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [May 5, 2021, 6:07pm UTC](https://forum.freecodecamp.org/t/error-in-test-for-javascript-algorithms-and-data-structures-projects-cash-register/458997 "2021-05-05T18:07:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff.bartelli](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeff.bartelli/32/216601_2.png) [@jeff.bartelli](https://forum.freecodecamp.org/u/jeff.bartelli)\
**Post date:** [May 5, 2021, 6:07pm UTC](https://forum.freecodecamp.org/t/error-in-test-for-javascript-algorithms-and-data-structures-projects-cash-register/458997/1 "2021-05-05T18:07:54Z")

</div>

I just completed the project “Cash Register” in the JavaScript Algorithms and Data Structures Projects for the JavaScript Algorithms and Data Structures certification and encountered an error on this test: 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]]).  
The problem should be obvious in these expected results: {status: “OPEN”, change: [[“TWENTY”, 60], [“TEN”, 20], [“FIVE”, 15], [“ONE”, 1], [“QUARTER”, 0.5], [“DIME”, 0.2], [“PENNY”, 0.04]]}. To clarify, the expected results for “change” are in the reverse order of the expected results for all other tests. This is to say that these expected results start with the largest denomination, while all other tests start with the smallest denomination. I was able to write an IF statement to accommodate this one test and finish the project, but this is an easy error to fix, so I hope somebody will update it!  
Thanks

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [May 5, 2021, 6:13pm UTC](https://forum.freecodecamp.org/t/error-in-test-for-javascript-algorithms-and-data-structures-projects-cash-register/458997/2 "2021-05-05T18:13:13Z")

</div>

This is intended, per the problem spec:

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

> Otherwise, return `{status: "OPEN", change: [...]}` , with the change due in coins and bills, sorted in highest to lowest order, as the value of the `change` key.

---

<div class="post-metadata">

**Author:** ![josemari.mercader64](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/josemari.mercader64/32/210346_2.png) [@josemari.mercader64](https://forum.freecodecamp.org/u/josemari.mercader64)\
**Post date:** [May 6, 2021, 4:34am UTC](https://forum.freecodecamp.org/t/error-in-test-for-javascript-algorithms-and-data-structures-projects-cash-register/458997/3 "2021-05-06T04:34:37Z")

</div>

hi there,

I really don’t view that as an error, that was really intended and logical even in the real world. You just have to read through the problem carefully and analyze; I had a difficult time solving this project as well, but in the end, the rest is really about data manipulation regardless what methods you employ to solve the challenge.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [November 4, 2021, 4:35pm UTC](https://forum.freecodecamp.org/t/error-in-test-for-javascript-algorithms-and-data-structures-projects-cash-register/458997/4 "2021-11-04T16:35:20Z")

</div>

Closed on November 4, 2021, 4:35pm UTC

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