-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreeting.html
More file actions
31 lines (27 loc) · 815 Bytes
/
Copy pathgreeting.html
File metadata and controls
31 lines (27 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE HTML>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Zach's Greeting</title>
<script>
/* Defining Table
* Input: A person's name
* Processing: Create a greeting for that person
* Output: The greeting
*/
function greetUser() {
// This line prompts the user to type in his name.
let name = prompt("Please enter your name");
let color = prompt("What is your favorite color?")
// Create a personalized greeting for the user.
let greeting = "Hello " + name + "! Your favorite color is " + color + "!";
// The next line causes the computer to display
// a greeting to the user in a popup window.
alert(greeting);
}
</script>
</head>
<body>
<button type="button" onclick="greetUser()">Click me!</button>
</body>
</html>