Finally completed the last challenge after almost 10 hours. What are your thoughts on this?

So tired but happy to be finally done. Would love to hear your thoughts on it and also about the difficulty level of the next certification. How harder is it as compared to this one?

  **Your code so far**

function checkCashRegister(price, cash, cid) {
let moneyDeno = [0.01, 0.05, 0.1, 0.25, 1, 5, 10, 20, 100];
let drawer = { status: "", change: [] };
let change = cash - price;
let change2 = change;
let changeArr = [];
let cashBackNum = 0;
let j = 0;
let moneyinDrawer = cid.reduce((sum, a) => sum + a[1], 0);
if (change < moneyinDrawer) {
  for (let i = cid.length - 1; i >= 0; i--) {
    cashBackNum = 0;
    if (moneyDeno[i] <= change && cid[i][1] >= moneyDeno[i]) {
      while (moneyDeno[i] <= change && cid[i][1] >= moneyDeno[i]) {
        cashBackNum += moneyDeno[i];
        change = (change - moneyDeno[i]).toFixed(2);
        changeArr[j][1] = cashBackNum;
        cid[i][1] -= moneyDeno[i];
      j += 1;
  drawer.change = changeArr;
  if (change2 < moneyinDrawer && change == 0) {
    drawer.status = "OPEN";
    return drawer;
  if (change != 0) {
    drawer.status = "INSUFFICIENT_FUNDS";
    drawer.change = [];
    return drawer;
else if (change2 === moneyinDrawer) {
  drawer.status = "CLOSED";
  drawer.change = cid;
  return drawer;
else if (change > moneyinDrawer) {
  drawer.status = "INSUFFICIENT_FUNDS"
  drawer.change = [];
  return drawer;
checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 OPR/76.0.4017.177

Challenge: Cash Register

Link to the challenge:

It is great that you solved the challenge, but we are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.
If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

well, I did put the spoiler tags in it. I was posting to ask for feedback and how I could do it better which I was going to edit it now. See my previous posts I have posted almost every single one and have had a very lively brainstorming discussion with the members here getting new ideas and algorithms/ways to tackle the problems. @ieahleen

Was so happy to have finally complete it. Sad that you unlisted.

Your post seemed to just be showing your solution, there was no indication that you were asking for feedback, and we don’t allow solutions to be shared just for the sake of it.
If you edit your post so that it is actually asking for feedback I am going to relist it

1 Like

Alright I will. Thank you.

Okay done @ieahleen

It’s different, it builds on what you have learned so far, and it will be difficult in a different way. You will learn to use JavaScript and its libraries and frameworks to make your web page interactive.

Difficult in a different way meaning? Not math/logic heavy but instead syntax heavy?

This current certificate was fun overall hopefully the next one will be too and hope I’ll get to use the skills learned here with a lot of effort, in a actual website.

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