Need Correction in my Code

Tell us what’s happening:

Your code so far

function checkCashRegister(price, cash, cid) {
var tchange = cash-price;
var cdollar = parseInt(tchange);
var penny = 100*(tchange-cdollar);

const register = cid.reverse().map(el => [el[0], Math.round(el[1])]);
const mcid = register.reduce((sum, elem) => (sum + elem[1]), 0);
if (mcid<tchange){
return {status: "INSUFFICIENT_FUNDS", change: tchange};
} else if (mcid==tchange){
  return {status: "CLOSED", change: tchange}
} else{
  var remain =0.00}
    var twentyChange = tchange/20;
    var twentydollar = parseInt(twentyChange)*20;
    remain = tchange%20;
    }else if (remain<20){
      var tenChange = remain/10;
      var tendollar = parseInt(tenChange)*10;
       remain = remain%10;
     }else if (remain<10){
      var fiveChange = remain/5;
      var fivedollar = parseInt(fiveChange)*5;
      remain = remain%5;
      }else if (remain<5){
      var oneChange = remain/1;
      var onedollar = parseInt(oneChange)*1;
      remain = remain%1;
      }else if (remain<0.25){
        var quarter = remain/0.25;
        var quarterdollar = parseInt(quarter)*0.25;
        remain = remain%0.25;
      }else if (remain<0.1){
        var dime = remain/0.1;
        var dimedollar = parseInt(dime)*0.1;
        remain = remain%0.1;
      }else if (remain<0.05){
        var nickel = remain/0.05;
        var nickeldollar = parseInt(nickel)*0.05;
        remain = remain%0.05;
      }else if (remain<0.01){
        var penny = remain/0.01;
        var pennydollar = parseInt(penny)*0.01;
        remain = remain%0.01;

  return {status: "OPEN", change:[["TWENTY", twentydollar], ["TEN", tendollar], ["FIVE", fivedollar], ["ONE", onedollar], ["QUARTER", quarterdollar], ["DIME", dimedollar], ["NICKEL", nickeldollar], ["PENNY", pennydollar]]}

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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Cash Register

Link to the challenge:

Your function is returning this… maybe you’ve mistakenly returned different things from function

Just figured out that tchange and cdollar are same thing, therefore, var penny = 100*(tchange-cdollar) will always be zero…