JavaScript Algorithms cash register challenge

Tell us what’s happening:
Describe your issue in detail here.
please I need help for this challenge,I don’t know what else to do in this code

  **Your code so far**

function checkCashRegister(price, cash, cid) {
let vuelto = cash-price;
let efeCaja = cid.map(x=> x[1]);
let sum = 0;
let mon = [0.01,0.05,0.1,0.25,1,5,10,20,100];
let acum = 0;
let newVuelto = [];
let newSum = 0;




for(let i=0;i<efeCaja.length;i++){
sum += efeCaja[i];
}


//Si está cerrada CLOSED
if( sum - vuelto < 0.0001){
  
 return {status: "CLOSED", change: cid};
} else {
  for(let i=efeCaja.length-1;i>-1;i--){
    
    while(vuelto>= mon[i] && mon[i]<=efeCaja[i]){
      vuelto = vuelto - mon[i];
      efeCaja[i] = efeCaja[i] - mon[i];
      acum = acum + mon[i];
    } 
    if(acum !== 0){
      newVuelto.push([cid[i][0],acum]);
    }
    acum = 0;
   
  } 

}


for(let i=0;i<newVuelto.length;i++){
newSum += newVuelto[i][1];
}
console.log(newSum)

if(newSum<vuelto){
  return {status:"INSUFFICIENT_FUNDS", change: []};

} else {

  return {status:"OPEN", change: newVuelto};
}



}

checkCashRegister(3.26, 100, [["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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36

Challenge: Cash Register

Link to the challenge:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.