An extra quarter and no 1.00... cash register

been at this too long. i want it done and over! :face_with_raised_eyebrow:

Now everything works except the 3.26 price vs 100 cash. it gives me an extra quarter, and ignores the dollar! Ive narrowed the ‘evilness’ to this area. For some reason, i get 204.99999999997!

filteredCid.forEach(elem => {

      let curr = elem[0];

      let currSum = Math.round(elem[1] * 100);

       cidSum += currSum;



        return {'statu  let amount = 0;

  while (changeSum >= benji[curr] && currSum > 0) {

       amount += benji[curr];

       changeSum -= benji[curr];

       currSum -= benji[curr];



     if (amount !== 0) { 

          change.push([curr, amount / 100]);



      if (changeSum > 0) {

        status = 'INSUFFICIENT_FUNDS';

        change = [];


        else if (changeSum == 0 && changeSumCheck == cidSum) {

          status = 'CLOSED';

          change = cid;



        } else { 

        status = 'OPEN';

      }s': status,'change': change};


You copy/pasted your code? Because it has various syntax errors. For instance:

return {'statu  let amount = 0;

That is not correct JavaScript syntax. Could you please copy/paste your code again?

And please, do copy/paste all your code :slight_smile:.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor ( </> ) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

It was a SINGLE WORD …all fixed! :joy:

1 Like