Tell us what’s happening:
The issue here is not so much the task as an interrupted syntax.I cannot find the unexpected token.
Your code
let price = 1.87;
let purchased = document.getElementById("purchase-btn");
let cash = document.getElementById("cash");
let changeDue = document.getElementById("#change-due");
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 cidDue = (cid, cash) => {
for (let i = 0; i <= cid.length; i++) {
cid.forEach(price, (cash) => {
return price - cash
})
}
};
const checkPrice = (price, cash) => {
purchased.addEventListener("click", () => {
if (cash < price) {
alert("Customer does not have enough money to purchase the item")
};
if (cash === price) {
changeDue.value = "No change due -customer paid with exact cash"
}
if (cash > price) {
changeDue.value = `${cidDue}`
}
})
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Challenge Information:
Build a Cash Register Project - Build a Cash Register