After i selected option 1 and after i add the number like 100 it results like this 100100
This is the code:
var userAmount;
var userMoney = 100;
var totalMoney;
alert("1. Add");
alert("2. Subtraction");
var userOption = prompt("Enter your selection: ");
if (userOption == 1) {
userAmount = prompt("Amount: ");
var totalMoney = userMoney + userAmount;
alert("Total is " + totalMoney);
}
else {
userAmount = prompt("Amount: ");
var totalMoney = userMoney - userAmount;
alert("Total is" + totalMoney);
}