Can someone take a look at my JS Cash Register and tell me what is wrong?

Hi Folks!

I think my code is pretty readable and self documenting … But somehow I just cant figure out the actual calcChangeDenoms (calculateChangeDenominations) function.

Here is is on JSbin

Anyways … tell me what you think. Any hints? I have been racking my brain for a day over this.

The first issue you have is your while loop is not executing correctly due to this line of code.

 changeDue =- thisDenom.val;

Second issue you are going to run into is you are first creating an array and then pushing it into changeArr. The second time around you are editing the array and pushing the same array into your changeArr again. So basically you have a second element in your changeArray that points to the first element in your change array.