Certificate program output matches requirements, but it does not register correct

Let me begin by saying I have not finished the program yet, but I am satisfying one required case that I know I can satisfy at this point before I tweak the rest of the program. With that said here is the problem I am working on:

here is the required output:

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]]) should return {status: "OPEN", change: [["QUARTER", 0.5]]} .

here is my console output on with the input for the above requirement:

{ status: ‘OPEN’, change: [ [ ‘QUARTER’, 0.5 ] ] }

Just curious what is going on and how to get the requirement to pass. I dont want to end up finishing this problem and not be able to finally pass my first module on FCC!!

if it is relevant to the problem here is the program I am working with:

function checkCashRegister(price, cash, cid) {
let change = cash - price


function CashRegister(){
  this.status = "OPEN",
  this.change = [["PENNY", 0], 
  ["NICKEL", 0], 
  ["DIME", 0], 
  ["QUARTER", 0], 
  ["ONE", 0], 
  ["FIVE", 0], 
  ["TEN", 0], 
  ["TWENTY", 0], 
  ["ONE HUNDRED", 0]] 
}

CashRegister.prototype ={
  hundred: function(){return Math.trunc(change / 100) * 100},
  twenty: function(){return Math.trunc(change / 20) *20},
  ten: function(){return Math.trunc(change / 10) *10},
  five: function(){return Math.trunc(change / 5) *5},
  one: function(){return Math.trunc(change / 1) *1},
  quart: function(){return Math.trunc(change / .25) *.25},
  dime: function(){return Math.trunc(change / .10) *.10},
  nick: function(){return Math.trunc(change / .05) *.05},
  pen: function(){return Math.trunc(change / .01) *.01}
}

let drawer = new CashRegister()





drawer.change[8][1] = drawer.hundred()
if(drawer.hundred() === 0){
  delete drawer.change[8]
} 
change -= drawer.hundred()

drawer.change[7][1] = drawer.twenty()
if(drawer.twenty() === 0){
  delete drawer.change[7]
}
change -= drawer.twenty()

drawer.change[6][1] = drawer.ten() 
if(drawer.ten() === 0){
  delete drawer.change[6]
}
change -=drawer.ten()

drawer.change[5][1] = drawer.five()
if(drawer.five() === 0){
  delete drawer.change[5]
}
change -=drawer.five()

drawer.change[4][1] = drawer.one()
if(drawer.one() === 0){
  delete drawer.change[4]
}
change -= drawer.one()

drawer.change[3][1] = drawer.quart()
if(drawer.quart() === 0){
  delete drawer.change[3]
}
change -= drawer.quart()

drawer.change[2][1] = drawer.dime() 
if(drawer.dime() === 0){
  delete drawer.change[2]
}
change -= drawer.dime()

drawer.change[1][1] = drawer.nick()
if(drawer.nick() === 0){
  delete drawer.change[1]
}
change -= drawer.nick()

drawer.change[0][1] = drawer.pen() 
if(drawer.pen() === 0){
  delete drawer.change[0]
}
change -= drawer.pen()

drawer.change = drawer.change.filter(x => x)

 return drawer 
}


console.log(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]]))

Consider what function returns. Is it object having only {status: "OPEN", change: [["QUARTER", 0.5]]}?

To give a bit bigger of a hint, if the solution was fully correct, what would this code show?

console.log(
  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]
    ]
  )
  .hundred
)
1 Like