my first real Javascript program – “the name game”

copy and paste it into an entirely blank html doc/web page or a notepad++ save it as HTML then open it to run it automatically in browser. If you want to share code, the easiest way is to upload it to a server and share the link.

<!DOCTYPE html>

<html>

<head>

<meta charset=”UTF-8″>

<title>name game</title>

</head>

<body>

<h1> the name game </h1>

<script>

var lastName = “”

var firstName = “”

var initial = “”

var name = “”

firstName = prompt(“Hi dickhead, what’s your first name?”, “”);

alert (“Hi, dickhead!” + ” I mean, ” + firstName, “”);

lastName = prompt(“What’s your surname then, beef?”,””)

initial = prompt(“Do you have a middle name? if not just make one up. What is your middle initial?”,””);

name = firstName + ” ” + initial + ” ” + lastName;

alert (“So your name is ” + name + ” That’s stupid!”);

</script>

</body>

</html>

Published by pflynt

My sense of humour is absurdist, inwardly bleak, caustic and morose, self-referential, rebellious and defiant, even in some cases sadistic, but overall sincere and even in the tragedies, hopeful.

Leave a comment

Design a site like this with WordPress.com
Get started