Your second prompt
statement does not assign anything to userinput
. Try this:
{
userinput = prompt('Enter direction (North,East,South,West or Q)', 'Q');
// ********** Go North ******************
if (userinput === 'North')
userinput = prompt('Would you like to go down Hole 1 or Hole 2?'); {
if (userinput === 'Hole 1') {
alert('You have found food for your family');
} else {
if (userinput === 'Hole 2') {
alert('You have been eaten by a fox');
}
}
}
}
4
solved Javascript RPG game