Why doesn't this work

goofymcdooperface

Estimable
Feb 19, 2014
5
0
4,510
<doctype! html>
<html>
<title> My test "game"
</title>

<body>
<script>
function Myfunction()
var x = prompt(" whats is your age?.");
if (x <13)
{
alert.("You may play the game but i take no response ability");
}
else
{
alert.("You are old enough to play . Have fun!!")
}
</script>
<button type = "button" onclick="Myfunction()"> Click me to play the game </button>
</body>
the goal is to have a pop up appear on your page when you press the button but for some reason chrome gives me an error message saying Uncaught SyntaxError: Unexpected token var

Uncaught ReferenceError: Myfunction is not defined

 

TRENDING THREADS