Tell us what’s happening:
I’m not close to coming up with a solution yet. But i think converting the 2D array to an object would be easier to work with. For some reason the method fromEntries doesn’t work. The array is a iterable object correct? I tried running the sample code on the Mozilla DEveloper Network concerning this method and their sample code doesn’t work either.
Your code so far
function checkCashRegister(price, cash, cid) {
var change;
// Here is your change, ma'am.
var objCid = Object.fromEntries(cid);
console.log(cid)
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 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register