Problem with Cash register Problem

Tell us what’s happening:
The way this problem is designed, I guess there’s some problem with the 5th test. can anyone help me with what I should do to return all the denominations
only when the status is closed.
Thanks in advance!

Your code so far

function checkCashRegister(price, cash, cid) {
  let denom = [
  { name: "ONE HUNDRED", val: 100.0 },
  { name: "TWENTY", val: 20.0 },
  { name: "TEN", val: 10.0 },
  { name: "FIVE", val: 5.0 },
  { name: "ONE", val: 1.0 },
  { name: "QUARTER", val: 0.25 },
  { name: "DIME", val: 0.1 },
  { name: "NICKEL", val: 0.05 },
  { name: "PENNY", val: 0.01 }
  let change = cash-price;
  let changeArr=[],f=0,ctr=0;
  let totalCash =0;>{
      if([0]){ = item[1]
    return {status: "INSUFFICIENT_FUNDS", change: []};
     denom =>{
      ctr=0;  f=0;
      while(change>=den.val &&>=den.val){
        change = Math.round(change*100)/100; = Math.round(*100)/100;

        changeArr.push([, ctr*den.val])
      return den;
    return {status: "INSUFFICIENT_FUNDS", change: []};
  console.log(totalCash, changeArr)  
  return {status:'CLOSED', change:changeArr};

  return {status:'OPEN', change:changeArr};

checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0.

Challenge: Cash Register

Link to the challenge:

i dont think this part looks good, for calculating the total cash, use

var totalCash = cid.reduce(accumulator, elem)=>accumulator+elem[1])

also, for the change variable use var keword, for variables that you’d need to access within the whole function (in multiple loops and if statements) it’s better to use var keyword

where are the curly braces for the if?
if you want to write it without them don’t have a new line

also, when you’re using map remember that it returns a new array, it doesnt change the array it acts on, when you want to change an array with map use

array_name =