-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path003.2-lexical.html
59 lines (55 loc) · 2.88 KB
/
003.2-lexical.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- add Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/global.css">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h1 id="message">Closure</h1>
<p class="lead">Let's shadow and reassign some variables in scope.</p>
</div>
<div class="col-lg-12">
<ol>
<li>Open <kbd>js/003.2-closure.js</kbd> in Sublime Text.</li>
<li>Review the functions, the log statements, and what is being logged in the console.</li>
<li>Shadow the variable <code>a</code> inside the <code>bar</code> function.
<ul>
<li>Hint: Create a local variable named <code>a</code> on line 10, and set it to a different value than <val>2</val>.</li>
</ul>
</li>
<li>Reassign the variable <code>b</code> inside the <code>bar</code> function.
<ul>
<li>Hint: Assign <code>b</code> on line 13 to a different value than <val>4</val>.</li>
</ul>
</li>
<li>Check whether or not the log statements are different in the console.</li>
<li>Check if assigning <code>b</code> a value without the <val>var</val> keyword created a global variable by typing the variable <code>b</code> in the console.</li>
</ol>
</div>
<div class="col-lg-12 text-center footer">
<ul class="list-unstyled">
<li><a href="003.1-lexical.html"><< Prev</a> | <a href="004-for-statement.html">Next >></a></li>
<li>Intermediate JavaScript & jQuery - <a href="https://twitter.com/ev_blurbs">Evan Johnson</a></li>
</ul>
</div>
</div>
<!-- /.row -->
</div>
<!-- /.container -->
<script src="js/003.2-lexical.js"></script>
</body>
</html>