So I am developing a game using only alerts and prompts. I have been having trouble with getting the game to stop if there is no text in the prompt. Can someone help please? Here is my code.
var food = 20;
var happy = 20;
var sleep = 20;
function setup(){
var input1 = prompt("Welcome to pet sim\r\nYour pet\'s food stat is "+food+", happy stat is "+happy+", and sleep stat is "+sleep+".\r\nWhat would you like to do?\r\n\"food\" \"play\" \"sleep\"");
if(input1="food"){
food++;
alert("Food eaten");
setup();
}else if(input1=null){
void(0);
}
}
setup();