Coding help needed!
var originalCost = "itemCost";
var newPrice;
var discount = "discount";
onEvent("startBtn", "click", function( ) {
setScreen("calculator");
});
onEvent("itemCost","click", function() {
getNumber;
});
onEvent("continue","click", function() {
setScreen("calculate2");
});
onEvent("calculate","click", function() {
setScreen("price");
calculate();
setText("finalPrice", newPrice);
});
onEvent("resetBtn","click", function(){
reset();
});
/// something isnt working here, I keep getting NaN "not a number as my result when i calculate"
function calculate() {
percentage();
newPrice = originalCost - (originalCost * discount);
}
function percentage() {
discount = discount/100;
}
function reset() {
onEvent("resetBtn","click",function() {
setScreen("calculator");
});
}
I am working on an app for my AP Computer Science Principles Create Portion, and I cannot get the app to run without the end result number showing as NaN, which I assume means “Not a Number”. If anybody could help that would be amazing.









