Build a Cash Register Project - Build a Cash Register

Tell us what’s happening:

Am stuck am I missing something?
Describe your issue in detail here.

Your code so far

<!-- file: index.html -->
<!Doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    

  </head>
  <body>
    <input id="cash" type="number" class="number"/>
<button class="button" id="purchase-btn">purchase</button>
<div id="change-due"></div>
    <script src="./script.js"></script>
  </body>
/* file: styles.css */

/* file: script.js */
let price = 1.87;
let cid = [
  ["PENNY", 1.01],
  ["NICKEL", 2.05],
  ["DIME", 3.1],
  ["QUARTER", 4.25],
  ["ONE", 90],
  ["FIVE", 55],
  ["TEN", 20],
  ["TWENTY", 60],
  ["ONE HUNDRED", 100]
];
const cash = document.getElementById("cash");
const pur = document.getElementById("purchase-btn");
const due = document.getElementById("change-due");


let cidtotal=0;
for(let elem of cid){
  cidtotal += elem[1]
}

let change = cash - price;
let chn = cidtotal - change;

const getChange = (num)=>{
let currVal = 0;
//let orgnum = Number(num.toFixed(2));
  for(let i = 0; i > cid.length;i++){
    let currVal = i
    if(change - currVal[1] > 0){
      console.log(currVal)
    }
  }



}



let yeschange="Status: OPEN" + getChange(change);
 let nomoney="Status: INSUFFICIENT_FUNDS"
let nochange="Status: CLOSED" + getChange(change);
 
 pur.addEventListener('click',
 (e)=>{   
   e.preventDefault()
 if(cash.value < price){
    alert("Customer does not have enough money to purchase the item")
 }else if(cash.value == price){
  due.innerText ="No change due - customer paid with exact cash"
}else if(cidtotal < change || change !== cidtotal){
  due.innerText = nomoney
 }else if(cidtotal === change){
 due.innerText= nochange
}else{//if(cidTotal >=changedue )
 due.innerText= yeschange
}
 })



Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 17_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Mobile/15E148 Safari/604.1

Challenge Information:

Build a Cash Register Project - Build a Cash Register

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Could you be a bit more specific? What do you mean by being stuck, what is giving you troubles?

,All the answers are insufficient funds

What have you tried so far? Take a look at the code, which is responsible for giving such result, what conditions have to be met for it? Check the relevant values (what they actually are in code, you can use console.log to print them co console), do they make sense?