forked from bethrobson/Head-First-JavaScript-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustSayin.html
More file actions
27 lines (22 loc) · 465 Bytes
/
justSayin.html
File metadata and controls
27 lines (22 loc) · 465 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Free Variables Exercise</title>
<script>
// This code won't work because justSayin needs an environment
// to "close" its free variables.
function justSayin(phrase) {
var ending = "";
if (beingFunny) {
ending = " -- I'm just sayin!";
} else if (notSoMuch) {
ending = " -- Not so much.";
}
alert(phrase + ending);
}
justSayin("Hey there!");
</script>
</head>
<body> </body>
</html>