-3

私はJavascriptが初めてで、知っていることはすべてどこかのサイトで学びました。古いバージョンの Javascript を使用しているのか、それとも jQuery などの他のソフトウェアのコードが含まれていたのかはわかりません。私が知っているのは、私のコードがelseステートメントに行きたくないということだけです。

<!Doctype html>
<html>
<body>
<center>
        <script>

confirm("Are you ready to play!");
var age = prompt("What/'s your age?");
if(age <= 18)
{
    document.write("you may play However i take no responsibility for your actions");
}
else
{
    document.write("Go ahead but your of age!");
}

document.write("Snow White and Batman were hanging out at the bus stop, waiting to go to the shops. There was a sale on and both needed some new threads. You've never really liked Batman. You walk up to him.");
document.write("Batman glares at you.");
var userAnswer = prompt('Are you feeling lucky, punk?');

if (userAnswer = "yes")
{
    document.write("Batman hits you very hard. It's Batman and you're you! Of course Batman wins!");
}
else
{
    document.write("You did not say yes to feeling lucky. Good choice! You are a winner in the game of not getting beaten up by Batman.");
}

var feedback = prompt("how good was the game out of 10?");

if (feedback >= 8)
{
    document.write ("This is just the beginning of my game empire. Stay tuned for more!");
}
else
{
    document.write("I slaved away at this game and you gave me that score?! The nerve! Just you wait!");
}

</script>
</center>
</body>
</html>
4

2 に答える 2