+ 1
watch out where you put the semicolons when setting ending, it's causing the unpredictable behavior you're seeing.
oh yeah also I changed this to an if else if else, format since the last part checks for infinite values and hits that recursive block otherwise.
function change(){
var diff=prompt("Choose difficulty: easy(5 days), normal(10 days), hard(30 days), impossible(50 days), infinite(999 days)","");
if (diff=="easy"||diff=="Easy"){ending=5;}
else if (diff=="normal"||diff=="Normal"){ending=10;}
else if (diff=="hard"||diff=="Hard"){ending=30;}
else if (diff=="impossible"||diff=="Impossible"){
ending=50;
}
else if (diff=="infinite"||diff=="Infinite"){ending=999;}
else {
alert("Incorrect option chosed, re-doing difficulty choice selection");
change();
}
+ 1
add a
user-select:none;
to the button css to prevent text selection on the button when clicking.