-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathday-2.html
377 lines (327 loc) · 10.6 KB
/
day-2.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>JavaScript for Beginners Day 2</title>
<meta name="author" content="Cameron Gose"/>
<style type="text/css">
.underline { text-decoration: underline; }
</style>
<link rel="stylesheet" href="./reveal.js/css/reveal.css"/>
<link rel="stylesheet" href="./reveal.js/css/theme/solarized.css" id="theme"/>
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = './reveal.js/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section id="sec-title-slide">
<h1 class="title">JavaScript for Beginners Day 2</h1><h2 class="author">Cameron Gose</h2><p class="date">Created: 2021-11-03 Wed 17:36</p>
</section>
<section>
<section id="slide-1">
<h2 id="1"><span class="section-number-2">1.</span> Take Home Review</h2>
<ul>
<li>Merge into master using github</li>
<li>Make sure to pull latest changes from master/main branch</li>
<li>Discuss the Github Workflow
<ul>
<li>Create a branch</li>
<li>Add commits</li>
<li>Open a Pull Request/Merge Request</li>
<li>Discuss and review</li>
<li>Merge into master/main branch</li>
</ul></li>
<li>Any questions?</li>
</ul>
</section>
</section>
<section>
<section id="slide-2">
<h2 id="2"><span class="section-number-2">2.</span> Git Review</h2>
<ul>
<li>Github</li>
<li>Create a Repository</li>
<li>Git workflow</li>
</ul>
</section>
</section>
<section>
<section id="slide-3">
<h2 id="3"><span class="section-number-2">3.</span> Data Types</h2>
<div class="outline-text-2" id="text-3">
</div>
</section>
<section id="slide-3-1">
<h3 id="3-1"><span class="section-number-3">3.1.</span> Primitive Data Types</h3>
<ul>
<li>String</li>
<li>Numbers</li>
<li>Boolean</li>
<li>Undefined</li>
<li>null</li>
<li>BigInt</li>
<li>Symbol</li>
</ul>
</section>
<section id="slide-3-1-1">
<h4 id="3-1-1"><span class="section-number-4">3.1.1.</span> String</h4>
<ul>
<li>Always wrapped in single or double quotes or template literals</li>
<li>.length property</li>
<li>Concatenation</li>
<li>Interpolation</li>
</ul>
</section>
<section id="slide-3-1-2">
<h4 id="3-1-2"><span class="section-number-4">3.1.2.</span> Number</h4>
<ul>
<li>Used for integers and decimal values</li>
<li>JavaScript using floating point numbers</li>
<li><p>
Infinity
</p>
<div class="org-src-container">
<pre class="src src-javascript"> <span style="color: #51afef;">const</span> <span style="color: #dcaeea;">maxNumber</span> = Math.pow(<span style="color: #dd8844; font-weight: bold;">10</span>, <span style="color: #dd8844; font-weight: bold;">1000</span>);
</pre>
</div></li>
<li><p>
NaN
</p>
<div class="org-src-container">
<pre class="src src-javascript"> <span style="color: #51afef;">let</span> <span style="color: #dcaeea;">num</span> = Number.parseInt(<span style="color: #99bb66;">"hello"</span>)
<span style="color: #51afef;">typeof</span>(num)
num === <span style="color: #a9a1e1;">NaN</span>
Number.isNaN(num)
num = Math.pow(<span style="color: #dd8844; font-weight: bold;">10</span>, <span style="color: #dd8844; font-weight: bold;">308</span>);
</pre>
</div></li>
</ul>
</section>
<section id="slide-3-1-3">
<h4 id="3-1-3"><span class="section-number-4">3.1.3.</span> Boolean</h4>
<ul>
<li>True/Truthy</li>
<li>False/Falsy</li>
</ul>
</section>
<section id="slide-3-1-4">
<h4 id="3-1-4"><span class="section-number-4">3.1.4.</span> Undefined</h4>
<ul>
<li>as name suggests hasn’t been defined yet</li>
<li>Show example</li>
</ul>
</section>
<section id="slide-3-1-5">
<h4 id="3-1-5"><span class="section-number-4">3.1.5.</span> Null</h4>
<ul>
<li>Similar to Undefined but it is an absence of value</li>
</ul>
</section>
<section id="slide-3-1-6">
<h4 id="3-1-6"><span class="section-number-4">3.1.6.</span> BigInt</h4>
<ul>
<li>Used for integers of longer length than number type</li>
<li>Created by adding “n” to end of integer</li>
</ul>
</section>
<section id="slide-3-1-7">
<h4 id="3-1-7"><span class="section-number-4">3.1.7.</span> Symbol</h4>
<ul>
<li>Create anonyous and unique values</li>
</ul>
</section>
<section id="slide-3-1-8">
<h4 id="3-1-8"><span class="section-number-4">3.1.8.</span> Grabbing the type</h4>
<ul>
<li>Use typeof</li>
<li>Show some examples</li>
</ul>
</section>
</section>
<section>
<section id="slide-4">
<h2 id="4"><span class="section-number-2">4.</span> Daily Challenge</h2>
<ul>
<li>In your js-practice repository (one we created last time):
<ul>
<li>Create a new branch named day-2</li>
<li>Using the .length property, log the length of the word “Supercalifragilisticexpialidocious” to the Console</li>
<li>Console log any number</li>
<li>Console log a BigInt</li>
<li>Use typeof to confirm you number and BigInt values</li>
<li>Add, commit, and push to you day-2 branch</li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-5">
<h2 id="5"><span class="section-number-2">5.</span> Daily Challenge Review</h2>
<ul>
<li>Questions</li>
</ul>
</section>
</section>
<section>
<section id="slide-6">
<h2 id="6"><span class="section-number-2">6.</span> Variables</h2>
<ul>
<li>var</li>
<li>let</li>
<li>const</li>
<li>Naming Variables</li>
<li>Hoisting</li>
</ul>
</section>
<section id="slide-6-1">
<h3 id="6-1"><span class="section-number-3">6.1.</span> var</h3>
<ul>
<li>Mostly don’t use any more</li>
<li>has strange scoping rules global unless within block</li>
<li>Can be redeclared</li>
<li>Can be used for hoisting</li>
</ul>
</section>
<section id="slide-6-2">
<h3 id="6-2"><span class="section-number-3">6.2.</span> let</h3>
<ul>
<li>Can be declared once within scope</li>
<li>It has a block scope</li>
<li>Can be reassigned</li>
</ul>
</section>
<section id="slide-6-3">
<h3 id="6-3"><span class="section-number-3">6.3.</span> const</h3>
<ul>
<li>Can be declared once within scope</li>
<li>It has a block scope</li>
<li>Cannot be reassigned</li>
<li>Show object and tell difference between that and reassignment</li>
</ul>
</section>
<section id="slide-6-4">
<h3 id="6-4"><span class="section-number-3">6.4.</span> Naming Variables</h3>
<ul>
<li>Names can contain letters, digits, underscores, and dollar signs.</li>
<li>Names must begin with a letter</li>
<li>Names are case sensitive (y and Y are different variables)</li>
<li>Reserved words (like JavaScript keywords) cannot be used as names</li>
</ul>
</section>
<section id="slide-6-5">
<h3 id="6-5"><span class="section-number-3">6.5.</span> Hoisting</h3>
<ul>
<li>var variable brought to top of code before var actually declared</li>
<li><p>
Also occurs with functions
</p>
<div class="org-src-container">
<pre class="src src-javascript"> <span style="color: #51afef;">var</span> <span style="color: #dcaeea;">pi</span> = <span style="color: #dd8844; font-weight: bold;">3.14</span>;
<span style="color: #51afef;">var</span> <span style="color: #dcaeea;">person</span> = <span style="color: #99bb66;">"John Doe"</span>;
<span style="color: #51afef;">var</span> <span style="color: #dcaeea;">answer</span> = <span style="color: #99bb66;">'Yes I am!'</span>;
writeToElement();
<span style="color: #51afef;">function</span> <span style="color: #c678dd;">writeToElement</span>() {
document.getElementById(<span style="color: #99bb66;">"demo"</span>).innerHTML =
pi + <span style="color: #99bb66;">"<br>"</span> + person + <span style="color: #99bb66;">"<br>"</span> + answer + <span style="color: #99bb66;">"<br>"</span> + x;
}
<span style="color: #51afef;">var</span> <span style="color: #dcaeea;">x</span> = <span style="color: #99bb66;">"This will be undefined"</span>
</pre>
</div></li>
</ul>
</section>
</section>
<section>
<section id="slide-7">
<h2 id="7"><span class="section-number-2">7.</span> Operators</h2>
<ul>
<li>Assignment</li>
<li>Arithmetic</li>
<li>Comparison / Logical</li>
</ul>
</section>
<section id="slide-7-1">
<h3 id="7-1"><span class="section-number-3">7.1.</span> Assignment Operators</h3>
<ul>
<li>= assignment</li>
<li>+= addition assignment</li>
<li>-= subtraction assignment</li>
<li>*= multiplication assignment</li>
<li>/= division assignment</li>
</ul>
</section>
<section id="slide-7-2">
<h3 id="7-2"><span class="section-number-3">7.2.</span> Arithmetic Operators</h3>
<ul>
<li>+ addition</li>
<li>- subtraction</li>
<li>* multiplication</li>
<li>/ division</li>
<li>% modulo</li>
</ul>
</section>
<section id="slide-7-3">
<h3 id="7-3"><span class="section-number-3">7.3.</span> Comparison / Logical Operators</h3>
<ul>
<li>== equal to</li>
<li><code>=</code> equal value and equal type</li>
<li>!= not equal</li>
<li>!== not equal value or not equal type</li>
<li>> greater than</li>
<li>< less than</li>
<li>>= greater than or equal to</li>
<li><= less than or equal to</li>
</ul>
</section>
</section>
<section>
<section id="slide-8">
<h2 id="8"><span class="section-number-2">8.</span> Take Home Challenge</h2>
<ul>
<li>Directions for the take home can be found in this Codepen: Mad Libs Challenge</li>
<li>If you want to save your work, you will need to create a free codepen account</li>
</ul>
</section>
</section>
</div>
</div>
<script src="./reveal.js/lib/js/head.min.js"></script>
<script src="./reveal.js/js/reveal.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: false,
center: true,
slideNumber: 'c',
rollingLinks: false,
keyboard: true,
mouseWheel: false,
fragmentInURL: false,
hashOneBasedIndex: false,
pdfSeparateFragments: true,
overview: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'convex', // see README of reveal.js for options
transitionSpeed: 'default',
// Optional libraries used to extend reveal.js
dependencies: [
{ src: './reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: './reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: './reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: './reveal.js/plugin/search/search.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: './reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }]
});
</script>
</body>
</html>