:cookie: 360 | @iangracia |http://www.freecodecamp.com/iangracia
innerText
with textContent
. If you want to reduce the list of var
s at the top, remove filterState
and filterApproach
at the beginning and just use states.value
and approach.value
and then combine aproachnode and statenode into titleState and titleApproach.
var card = document.getElementsByClassName("card-parent");
var titleState = Array.from(document.getElementsByClassName("space-state"));
var titleApproach = Array.from(document.getElementsByClassName("space-approach"));
"Design a cash register drawer function checkCashRegister() that accepts purchase price as the first argument (price), payment as the second argument (cash), and cash-in-drawer (cid) as the third argument.
cid is a 2D array listing available currency.
Return the string "Insufficient Funds" if cash-in-drawer is less than the change due. Return the string "Closed" if cash-in-drawer is equal to the change due.
Otherwise, return change in coin and bills, sorted in highest to lowest order."
Test:
checkCashRegister(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1.00], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return "Insufficient Funds"
Shouldn't the above test return 0.5?? and not "Insufficient Funds"