Cash Register help

Cash Register help
0

#1

Tell us what’s happening:
is there is any video to help me understand how to solve the challenge ?

Your code so far


function checkCashRegister(price, cash, cid) {
  var change;
  // Here is your change, ma'am.
  return change;
}

// Example cash-in-drawer array:
// [["PENNY", 1.01],
// ["NICKEL", 2.05],
// ["DIME", 3.1],
// ["QUARTER", 4.25],
// ["ONE", 90],
// ["FIVE", 55],
// ["TEN", 20],
// ["TWENTY", 60],
// ["ONE HUNDRED", 100]]

checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register/


#2

What part of the instructions do you not understand? All a video is going to do is show you one way out of a hundred to solve this problem. Try to think about the actual steps you would take if you were a store clerk needing to give change. See if you can write the steps in plain language (no code) on paper first and then try to use those written steps on one of the test cases. Once you think your written steps (your algorithm) would pass all the tests, then begin translating your written steps to JavaScript code.

Trying to start coding immediately on this challenge will lead to many hours of wasted time and frustration. If you want to post your attempt at writing the steps, we would be happy to review them and give you any pointers. Also, once you are ready to post any code you have written which does not work or you can not figure out how to make the correct translation of your written steps, we would gladly take a look too.