Build a Cash Register Project - Build a Cash Register

Hi!
I have the function getChange where the rest is not appear correctly.
And I have another problem with the lastpoint of the user story. Why have to give the cash-due text including the Quarter $0 Dime $0 Nickel $0 Penny $0.5 instead of Penny $0.5?

Thank you very much!

let price = 19.5;

let cid = [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]];


document.addEventListener('DOMContentLoaded', function() {
const priceElement = document.getElementById('product-price');
priceElement.textContent = `Product price is: $${price}.`;
});
function arrSommed(arr) {

let sommaArr = cid.map(elem => {

return elem[1];
});

let somma = 0;

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

return somma.toFixed(2);
}

function getChange(rest, arr) {
  const currencyUnit = {
    PENNY: 0.01,
    NICKEL: 0.05,
    DIME: 0.1,
    QUARTER: 0.25,
    ONE: 1,
    FIVE: 5,
    TEN: 10,
    TWENTY: 20,
    "ONE HUNDRED": 100
  };

// Here the rest is $0.492.... if the price is $19.5 and the cash is $20.

let restElement = document.getElementById("rest");
restElement.textContent = "You have to receive as rest: " + rest + ".";
  let result = [];
let newArr = highestToLowest(arr);
  for (let i = 0; i <newArr.length; i++) {
    let [currencyName, currencyTotal] = newArr[i];
    const currencyValue = currencyUnit[currencyName];


    let resultItem = [currencyName, 0];
    while (rest >= currencyValue && currencyTotal > 0) {
      rest -= currencyValue;
      currencyTotal -= currencyValue;
      resultItem[1] += currencyValue;
    }

    if (resultItem[1] > 0) {
      result.push(resultItem);
    }
  }

return result;
}



function giveTheRest() {
const cashElement = document.getElementById('cash').value;
let changeDueElement = document.getElementById('change-due');
if (cashElement < price) {
alert("Customer does not have enough money to purchase the item");

}

if (cashElement == price) {
changeDueElement.textContent = "No change due - customer paid with exact cash";
} else {
const theRest = cashElement - price;

// Here theRest is equal to $0.5 if the price is $19.5 and the cash is $20.

console.log(`The rest is: $${theRest}.`);
const change = getChange(theRest, cid);
const cidValuesSommed = arrSommed(cid);
console.log(cidValuesSommed);

if (cidValuesSommed < theRest) {
changeDueElement.textContent = "Status: INSUFFICIENT_FUNDS.";

} else {
changeDueElement.textContent = displayMessage(change);

}

}

return changeDueElement;
}

function highestToLowest(arr) {
arr.sort(function(a, b) {
return b[1] - a[1];
});
return arr;
}

function displayMessage(arr) {
const resultValuesSommed = arrSommed(arr);
const cidValuesSommed = arrSommed(cid);
const arrHighest = highestToLowest(arr);
let message = '';

if (arr === undefined) {
    message = "Status: INSUFFICIENT_FUNDS";

  } else if (resultValuesSommed == cidValuesSommed) {
    message = "Status: CLOSED ";
for (let i = 0; i < arrHighest.length; i++) {
message += `${arrHighest[i][0]} $${arrHighest[i][1]} `;
}
message += ".";

  } else {
message = "Status: OPEN ";
    for (let i = 0; i < arrHighest.length; i++) {
      message += `${arrHighest[i][0]} $${arrHighest[i][1]} `;
    }
message += ".";
  }
return message;
}