forked from gdiseattle/gdi-es6-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass1.html
More file actions
1108 lines (1002 loc) · 48.2 KB
/
class1.html
File metadata and controls
1108 lines (1002 loc) · 48.2 KB
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Modern JavaScript, ES6 and beyond</title>
<meta name="description" content="Materials and slides for a Girl Develop It ES6 JavaScript course. Includes ES7's minor additions.">
<meta name="author" content="Girl Develop It">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="dist/css/reveal.css">
<link rel="stylesheet" href="dist/css/gdidarkblue.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor -->
<link rel="stylesheet" href="dist/css/light.css">
<!-- dark editor <link rel="stylesheet" href="dist/css/dark.css">-->
<!-- <link rel="stylesheet" href="dist/css/zenburn.css"> -->
<link rel="stylesheet" href="plugin/accessibility-helper/css/accessibility-helper.css">
<!-- 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 = 'dist/css/print/pdf.css';
document.getElementsByTagName('head')[0].appendChild(link);
}
</script>
<!-- If use the PDF print sheet so students can print slides-->
<link rel="stylesheet" href="dist/css/print/pdf.css" type="text/css" media="print">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<!--[if lt IE 9]>
<script src="dist/js/html5shiv.js"></script>
<![endif]-->
</head>
<body spellcheck="false">
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<!-- Opening -->
<section class="small">
<h1>Modern JavaScript ES6 and beyond</h1>
<img src="dist/img/circle-gdi-logo.png" alt="GDI Logo" class="noborder" />
<h2>Class 1</h2>
</section>
<!-- Compatibility-->
<!-- Welcome! -->
<section class="hide-pdf">
<h2>Welcome!</h2>
<p>Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on
instruction.</p>
<p> </p>
<p class="green">Some "rules"</p>
<ul>
<li>We are here for you!</li>
<li>Every question is important</li>
<li>Help each other</li>
<li>Have fun</li>
</ul>
</section>
<!-- First Things First -->
<section class="hide-pdf">
<h2>First Things First</h2>
<p class="green">Tell us about yourself.</p>
<ul>
<li>Who are you?</li>
<li>What do you hope to get out of the class?</li>
<li>What is your favorite restaurant or coffee shop in Seattle?</li>
</ul>
</section>
<section>
<h2>Course Format</h2>
<ul class="small">
<li>In-Class Activities</li>
<li>At-Home Challenges</li>
<li>Slides:
<a href="https://github.com/gdiseattle/gdi-es6-javascript" target="_blank">https://github.com/gdiseattle/gdi-es6-javascript</a>
</li>
</ul>
<p> </p>
<p>
<span class="orange">Need help?</span>
<br />Note the resources on the whiteboard</p>
<p>
<strong>Thank you to our wonderful TAs!</strong>
</p>
<aside class="notes">Mention that there will be HW. Will review the solution before each class, and talk about potential other solutions.</aside>
</section>
<!-- Get Started -->
<section>
<h2>Get Started: Tools</h2>
<p>We'll be using the following tools in class:</p>
<p> </p>
<ul>
<li>
<div class="blue">
<strong>Environment</strong>
</div>
<ul>
<li>An optional
<a href="http://codepen.io" target="_blank">CodePen</a> account</li>
<li>
<a href="https://nodejs.org/">Node.js</a> (version 6 or higher)</li>
</ul>
</li>
<li>
<div class="blue">
<strong>Command Line Interface (your preference)</strong>
</div>
<ul>
<li>
<em>Terminal</em>,
<em>cmd</em>,
<em>X11</em>,
<em>Git Bash</em>, etc.</li>
</ul>
</li>
<li>
<div class="blue">
<strong>Text Editor (your preference)</strong>
</div>
<ul>
<li>
<a href="https://code.visualstudio.com/" target="_blank;">Visual Studio Code</a>,
<a href="https://atom.io/" target="_blank">Atom</a>,
<a href="http://www.sublimetext.com/2" target="_blank">
<span data-title="SublimeText">SublimeText</span>
</a>,
<a href="https://www.jetbrains.com/webstorm/" target="_blank">
<span data-title="WebStorm">WebStorm</span>
</a>, etc.
</li>
</ul>
</li>
</ul>
<aside class="notes">Ask if everyone was able to download everything. If not, no big deal. download now. CodePen recommended if they want
to fork the practice exercises and save for later (will review on next slide). WebStorm is the only paid program on
this list, but it's super useful if you plan on doing a ton of large JavaScript app development in future.</aside>
</section>
<section class="activity" data-background="rgb(6, 116, 123)">
<h2>Optional Activity</h2>
<h3>
<svg id="embed-codepen-logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
x="0px" y="0px" width="270.438px" height="50.257px" viewBox="0 0 411.438 74.257" enable-background="new 0 0 411.438 74.257"
xml:space="preserve">
<g>
<path class="cp-embed-logo" d="M25.857 18.232c4.618 0 8.85 1.67 12.14 4.429l4.472-5.33c-4.496-3.779-10.29-6.061-16.61-6.061 C11.6 11.27 0 22.87 0 37.128c0 14.26 11.6 25.86 25.86 25.856c6.32 0 12.114-2.282 16.61-6.061l-4.472-5.33 c-3.286 2.761-7.521 4.429-12.139 4.429c-10.419 0-18.896-8.476-18.896-18.894C6.962 26.71 15.44 18.23 25.86 18.232z"></path>
<path class="cp-embed-logo" d="M168.993 12.763H155.07c-1.922 0-3.48 1.559-3.48 3.48v41.769c0 1.92 1.56 3.48 3.48 3.48h13.923 c13.436 0 24.365-10.93 24.365-24.365C193.358 23.69 182.43 12.76 168.99 12.763z M168.993 54.532h-10.442V19.725h10.442 c9.597 0 17.4 7.81 17.4 17.404C186.397 46.73 178.59 54.53 168.99 54.532z"></path>
<path class="cp-embed-logo" d="M212.206 16.244v41.769c0 1.92 1.56 3.48 3.48 3.48h29.007v-6.961h-25.525V40.608h16.243v-6.961h-16.243 V19.725h25.525v-6.961h-29.007C213.765 12.76 212.21 14.32 212.21 16.244z"></path>
<path class="cp-embed-logo" d="M317.569 16.244v41.769c0 1.92 1.56 3.48 3.48 3.48h29.006v-6.961H324.53V40.608h16.244v-6.961H324.53 V19.725h25.525v-6.961H321.05C319.128 12.76 317.57 14.32 317.57 16.244z"></path>
<path class="cp-embed-logo" d="M284.443 12.763h-15.084c-1.922 0-3.48 1.559-3.48 3.48v45.25h6.962V40.608h11.603 c7.677 0 13.923-6.246 13.923-13.922C298.366 19.01 292.12 12.76 284.44 12.763z M284.443 33.647h-11.603V19.725h11.603 c3.839 0 6.96 3.12 6.96 6.961S288.282 33.65 284.44 33.647z"></path>
<path class="cp-embed-logo" d="M404.476 12.763v35.636l-28.652-34.384c-0.938-1.127-2.481-1.545-3.859-1.045 c-1.378 0.5-2.296 1.808-2.296 3.273v45.25h6.962V25.858l28.652 34.383c0.675 0.81 1.66 1.25 2.67 1.25 c0.396 0 0.797-0.066 1.185-0.207c1.378-0.5 2.296-1.808 2.296-3.273v-45.25H404.476z"></path>
<path class="cp-embed-logo" d="M131.815 25.261c-0.017-0.09-0.032-0.18-0.056-0.268c-0.015-0.053-0.033-0.103-0.05-0.155 c-0.025-0.078-0.051-0.156-0.082-0.232c-0.022-0.053-0.047-0.104-0.071-0.155c-0.034-0.072-0.069-0.143-0.109-0.212 c-0.028-0.051-0.06-0.099-0.091-0.148c-0.043-0.066-0.087-0.131-0.135-0.194c-0.035-0.047-0.071-0.092-0.109-0.137 c-0.05-0.06-0.104-0.117-0.158-0.173c-0.042-0.042-0.084-0.084-0.128-0.125c-0.058-0.053-0.118-0.103-0.181-0.151 c-0.048-0.037-0.095-0.075-0.145-0.109c-0.018-0.013-0.034-0.028-0.053-0.04L96.511 0.536c-1.071-0.715-2.468-0.715-3.539 0 L59.034 23.161c-0.019 0.012-0.034 0.027-0.053 0.04c-0.05 0.035-0.097 0.072-0.145 0.109c-0.062 0.049-0.123 0.099-0.181 0.15 c-0.044 0.04-0.086 0.082-0.127 0.125c-0.056 0.056-0.108 0.113-0.159 0.173c-0.038 0.045-0.074 0.09-0.109 0.14 c-0.048 0.063-0.092 0.127-0.135 0.194c-0.031 0.049-0.062 0.097-0.091 0.148c-0.04 0.069-0.075 0.14-0.108 0.21 c-0.024 0.051-0.05 0.103-0.071 0.155c-0.031 0.076-0.058 0.154-0.083 0.232c-0.017 0.052-0.035 0.103-0.049 0.15 c-0.023 0.088-0.04 0.177-0.056 0.268c-0.009 0.046-0.02 0.091-0.026 0.138c-0.018 0.138-0.028 0.276-0.028 0.417V48.44 c0 0.14 0.01 0.28 0.03 0.417c0.007 0.05 0.02 0.09 0.03 0.138c0.016 0.09 0.03 0.18 0.06 0.27 c0.014 0.05 0.03 0.1 0.05 0.155c0.025 0.08 0.05 0.16 0.08 0.233c0.021 0.05 0.05 0.1 0.07 0.15 c0.033 0.07 0.07 0.14 0.11 0.213c0.028 0.05 0.06 0.1 0.09 0.146c0.043 0.07 0.09 0.13 0.14 0.19 c0.035 0.05 0.07 0.09 0.11 0.138c0.051 0.06 0.1 0.12 0.16 0.173c0.041 0.04 0.08 0.09 0.13 0.12 c0.058 0.05 0.12 0.1 0.18 0.152c0.048 0.04 0.1 0.07 0.14 0.109c0.019 0.01 0.03 0.03 0.05 0.039L92.972 73.72 c0.536 0.36 1.15 0.54 1.77 0.537s1.234-0.18 1.77-0.537l33.938-22.625c0.019-0.012 0.035-0.026 0.053-0.039 c0.05-0.035 0.097-0.072 0.145-0.109c0.062-0.049 0.123-0.1 0.181-0.152c0.044-0.039 0.086-0.082 0.128-0.124 c0.055-0.056 0.108-0.113 0.158-0.173c0.038-0.045 0.074-0.09 0.109-0.138c0.048-0.063 0.092-0.128 0.135-0.194 c0.031-0.048 0.062-0.097 0.091-0.146c0.04-0.07 0.075-0.141 0.109-0.213c0.024-0.051 0.049-0.102 0.071-0.154 c0.031-0.077 0.057-0.155 0.082-0.233c0.017-0.052 0.035-0.103 0.05-0.155c0.023-0.088 0.039-0.178 0.056-0.268 c0.008-0.046 0.02-0.091 0.025-0.138c0.018-0.138 0.028-0.276 0.028-0.417V25.816c0-0.141-0.011-0.279-0.028-0.417 C131.835 25.35 131.82 25.31 131.81 25.261z M94.741 44.677l-11.285-7.548l11.285-7.549l11.286 7.549L94.741 44.677z M91.551 24.037L77.717 33.29L66.55 25.82L91.551 9.153V24.037z M71.978 37.128l-7.982 5.339V31.789L71.978 37.128z M77.717 40.97 l13.834 9.252v14.884L66.55 48.437L77.717 40.968z M97.932 50.22l13.834-9.252l11.168 7.469L97.932 65.104V50.22z M117.505 37.13 l7.983-5.34v10.679L117.505 37.128z M111.766 33.29l-13.834-9.252V9.153l25.002 16.667L111.766 33.29z"></path>
</g>
</svg>
</h3>
<ol>
<li>Login to
<a href="http://codepen.io" target="_blank">http://codepen.io</a> (it's free!)</li>
<li>For each CodePen exercise, click
<code>Edit on CodePen</code>
</li>
<li>Click the
<code>Fork</code> button at the top</li>
<li>Edit away! Your changes will save to a new pen in your CodePen account</li>
</ol>
<p data-height="150" data-theme-id="dark" data-slug-hash="GmqavN" data-default-tab="js" data-user="anythingcodes" data-embed-version="2"
data-pen-title="Block-scoping: ES5 (Before)" class="codepen">See the Pen
<a href="http://codepen.io/anythingcodes/pen/GmqavN/">Block-scoping: ES5 (Before)</a> by Liz Shaw (
<a href="http://codepen.io/anythingcodes">@anythingcodes</a>) on
<a href="http://codepen.io">CodePen</a>.</p>
<aside class="notes">Show students how to fork a CodePen and save their work for each exercise.</aside>
</section>
<!--<section class="activity" data-background="rgb(6, 116, 123)">
<h2>Activity</h2>
<h3>Node.js Check</h3>
<ol>
<li>Open your favorite command line application (such as <em>Terminal</em> or <em>cmd</em>)</li>
<li>Type in <code>node -v</code> and press <em>Enter</em></li>
<li>If your version is <em>6</em>, you're good to go!</li>
</ol>
<p><img src="dist/img/nodejs.png" alt="NodeJS logo" style="max-height: 150px;background-color:#fff;" /></p>
<p class="small"><em>No luck? No problem — we won't be using Node.js until a later session. See a TA or instructor after class and we'll help you out!</em></p>
</section>-->
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em;">Background</h1>
</section>
<section>
<h2>What is ECMAScript?</h2>
<div class="small clear">
<div class="halfblock">
<p class="blue underlined">📄 Standard:</p>
<ul>
<li>
<span class="green">ECMAScript</span>, abbreviated
<span class="green">ES</span>, is a standard</li>
<li>Describes features, syntax, and behavior of all
<span class="blue">implementations</span>
</li>
<li>Think of it as a ruleset or blueprint</li>
</ul>
<p class="blue underlined">
<br />✍ Implementation:</p>
<ul>
<li>
<span class="green">JavaScript</span> is one implementation of the
<span class="green">ECMAScript</span> standard</li>
</ul>
</div>
<div class="halfblock">
<!--<img src="dist/img/flowchart-es-js.svg" alt="ES6's relationship to JavaScript" />-->
<div class="fragment-progression">
<div class="fragment">
<img src="dist/img/house1.png" alt="The standard, ECMAScript, is the ruleset, or blueprint" />
</div>
<div class="fragment">
<img src="dist/img/house2.png" alt="The implementation, JavaScript, is the language that uses that ruleset's plan, or built house/product"
/>
</div>
</div>
</div>
</div>
<aside class="notes">
<ul>
<li>ECMAScript and ES terms are interchangeable</li>
<li>There are plenty of other implementations of ECMAScript, including ActionScript</li>
</ul>
</aside>
</section>
<section>
<h2>History</h2>
<p>
<img src="dist/img/history-es6.png" alt="The history of ECMAScript and JavaScript" />
</p>
<ul class="fragment">
<li>
<span class="orange">June 2015:</span>
<span class="blue">ES6</span> / ES2015
<a style="font-size:.6em;" href="http://es6-features.org/" target="_blank">(ECMAScript 6 features)</a>
</li>
<li>
<span class="orange">June 2016:</span>
<span class="blue">ES7</span> / ES2016
<a style="font-size:.6em;" href="http://exploringjs.com/es2016-es2017/" target="_blank">(Array.prototype.includes, ** operator)</a>
</li>
<li>
<span class="orange">June 2017:</span>
<span class="blue">ES8</span> / ES2017
<a style="font-size:.6em;" href="http://exploringjs.com/es2016-es2017/" target="_blank">(async / await, Object values / entries, etc.)</a>
</li>
<li>
<span class="orange">expected in 2018:</span>
<span class="blue">ES9</span> / ES2018
<a style="font-size:.6em;" href="http://exploringjs.com/es2018-es2019/pt_es2018.html" target="_blank">(async iteration, etc.)</a>
</li>
<li>
<span class="orange">ES.Next:</span>
<span style="font-size:.7em;">Next version of ECMAScript coming out, right now it's
<span class="blue">ES9</span>
</span>
</li>
<li class="fragment">
<a style="font-size:.7em;" href="https://flaviocopes.com/ecmascript" target="_blank">The Complete ES2015-ES2017 guide</a>
</li>
</ul>
<aside class="notes">
<ul>
<li>ES4 never released due to political reasons we won't get into :)</li>
<li>ES6 is sometimes called ECMAScript 2015 because it was released in 2015. ES6 and ECMAScript are the same thing. This
is true for ES7, a.k.a. ECMAScript 2016.</li>
<li>ES6 gets the most attention because it was a huge spec overhaul. It introduced a ton of new features. ES7 and all versions
going forward will be smaller, more incremental changes; ES7 only introduced two new features, so we'll discuss them
as part of this class.</li>
</ul>
</aside>
</section>
<!--<section>
<h2>Why use ES6?</h2>
<ul style="font-size:90%;">
<li>Sure, there are handy new methods, syntax, and easier-to-read code, but...</li>
<li class="fragment">Top JavaScript libraries will be written in ES6. If you aren't familiar with ES6, you'll be at a disadvantage when trying to read documentation and build new features.</li>
<li class="fragment">Backwards compatible</li>
<li class="fragment">Integrates nicely with modern build tools</li>
</ul>
<p class="fragment"><br /><span class="orange">🌟 Above all, it's the new standard.</span> This means that, in the near future, ES6 will be standard in each browser.</p>
<aside class="notes">
<ul>
<li>Bigger leap than what existed in previous standards</li>
<li>Everything relevant going forward will use ES6</li>
</ul>
</aside>
</section>-->
<section>
<h2>Today's Topics</h2>
<ol>
<li>Transpiling</li>
<li>Let & Const</li>
<li>Linters</li>
<li>Template Strings</li>
<li>Enhanced Object Literals</li>
<li>Classes</li>
<!--<li>String Helpers</li>-->
</ol>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em;">Transpiling</h1>
</section>
<section>
<h2>
<span class="green">Transpiling</span> = Source-to-source compiling</h2>
<p> </p>
<a target="_blank" href="https://babeljs.io/repl">
<img src="dist/img/transpiling.svg" alt="Transpiling" />
</a>
<div class="transpiler clear">
<div class="halfblock">
<h3 class="green">Before: ES6</h3>
<pre><code contenteditable class ="javascript transpiler__input">const getMessage = () => 'Hello World';</code></pre>
</div>
<div class="halfblock">
<h3 class="green">After: ES5</h3>
<pre><code class="javascript transpiler__output">Waiting...</code></pre>
</div>
</div>
<p> </p>
<aside class="notes">Point out how this code block is being transpiled to that via Babel. Break the ES6 code as an example. Ask who's seen
a
<code>src</code> and
<code>dist</code> folder. Both of these are creating a function that returns 'Hello World'. You and your team can focus on writing readable,
less error-prone code in fewer lines. Enforces good coding practices behind the scenes (
<code>'use strict';</code>). Allows you to focus on writing readable code in less lines. Build tools (e.g. WebPack) integrate nicely with this
workflow and can be used to minify the ES5 result, add linting, add prefixes to CSS automatically, etc. [[[Browsers
don’t yet implement natively a lot of ES6+ features, and developers want to innovate on what JavaScript is. This means
they’ve built tools like Babel that implement futuristic JavaScript features and compile down to ES5.]]]
</aside>
</section>
<section>
<h2>Benefits to Transpiling</h2>
<ul>
<li class="fragment">Browser support
<ul>
<li>
<a href="http://kangax.github.io/compat-table/es6/" target="_blank">http://kangax.github.io/compat-table/es6/</a>
</li>
<li>
<a href="https://caniuse.com/#search=ES6" target="_blank">https://caniuse.com/#search=ES6</a>
</li>
</ul>
</li>
<li class="fragment">No need to wait for browsers/engines to catch up with the ECMAScript specification</li>
<li class="fragment">Focus on writing clean, easy-to-read code — compile it to a cross-browser-compatible format</li>
<li class="fragment">JavaScript will continue to
<a href="https://dayssincelastjavascriptframework.com/" target="_blank">evolve constantly</a>; without transpilation, you'll miss out on innovations that make JavaScript more effective, efficient,
and robust</li>
</ul>
</section>
<section>
<h2>Transpiling Setup</h2>
<p>You can set this up on your machine using Node.js. For now, CodePen can use Babel to transpile ES6 for us.</p>
<p>
<img src="dist/img/codepen-babel.gif" style="border: 1px solid black;max-height:40vh;" alt="Using the Babel transpiler in CodePen"
/>
</p>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em;">Let & Const</h1>
<aside class="notes">Can someone tell me what scope means in the context of programming in general?</aside>
</section>
<section>
<h2>Scopes 🔬</h2>
<ul class="small" style="list-style-type: none;">
<li>
<strong class="green">Until ES6 JavaScript only had global and function level scope</strong>
<pre><code contenteditable class="javascript">function func() {
// function required
}</code></pre>
</li>
<li>
<img src="dist/img/js-es5-scope-2.png" />
</li>
</ul>
<p style="margin-top:.3em;" class="fragment">
<code>var</code>
<span class="orange">only respects function scopes</span>
</p>
<aside class="notes">
Many programmers were used to block scoped variables. This made programming in JavaScript unintuitive and inconsistent for
many who were used to block scoping.
<ul>
<li>Ask what the other form of scope is BEFORE the function scope definition shows.</li>
<li>
<code>alwaysSunny</code> exists in the global scope</li>
<li>A
<strong>function</strong> cordons off an area. Plain old
<code>{}</code> does not. Any variables defined in a function remain scoped there, and aren't accessible outside.</li>
<li>When you see the word
<strong>function</strong>, it should trigger the fact that a new scope/context has been created. Any variables defined there
are scoped to that area.</li>
</ul>
</aside>
</section>
<section>
<h2>Scopes 🔬</h2>
<ul class="small" style="list-style-type: none;">
<li>
<strong class="green">Block Scopes (a.k.a. lexical scopes):</strong>
<pre><code contenteditable class="javascript">{
// block is anything within { } that isn't a function or a declaration of an object
}
</code></pre>
<ul class="small">
<li>
<span class="blue">Examples:</span>
<code>{ }</code>,
<code>if () { }</code>,
<code>for() {}</code>,
<code>while() { }</code>, etc.
<img src="dist/img/scope_diagram.png" />
</li>
<li>Allows us to declare variables as close as possible to where they will be used.</li>
<li>Allows us to minimize chances of variables conflict / allows to reuse variable names in different places within a
function.</li>
</ul>
</li>
</ul>
<p class="fragment small info">
<a href="https://github.com/getify/You-Dont-Know-JS/blob/master/scope%20%26%20closures/ch3.md" target="_blank">Function vs. Block Scope »</a>
</p>
<aside class="notes">
Most languages use block scopes. This made programming in JavaScript unintuitive and inconsistent for many who were used
to block scoping.
<ul>
<li>Ask what the other form of scope is BEFORE the function scope definition shows.</li>
<li>
<code>alwaysSunny</code> exists in the global scope</li>
<li>A
<strong>function</strong> cordons off an area. Plain old
<code>{}</code> does not. Any variables defined in a function remain scoped there, and aren't accessible outside.</li>
<li>When you see the word
<strong>function</strong>, it should trigger the fact that a new scope/context has been created. Any variables defined there
are scoped to that area.</li>
</ul>
</aside>
</section>
<!--<section>
<h2>Function Scope Problems</h2>
<p><code>var</code> variables are <span class="green">function-scoped</span>.<br />They ignore block scoping.</p>
<div style="min-height: 200px;">
<p data-height="200" data-theme-id="dark" data-slug-hash="YabKgr" data-default-tab="js,result" data-user="martik41" data-embed-version="2" data-pen-title="Block-scoping: ES5 (Before)" class="codepen">See the Pen <a href="https://codepen.io/martik41/pen/YabKgr">Block-scoping: ES5 (Before)</a></p>
</div>
<p>To fake block scoping, an <span class="green">immediately-invoked function expression (IIFE)</span> is often used</p>
<a class="solution solution__lesson-1" href="http://codepen.io/anythingcodes/pen/zwBQEX?editors=0010" target="_blank">View Solution</a>
<aside class="notes">
<ol>
<li>DON'T open console, ask students:
<ol>
<li>What would the output be?</li>
<li>What if we want it to say Alpha, and then Beta? How can we solve this? (one potential solution: IIFE)</li>
</ol>
</li>
<li>{ ... } is perfectly valid JavaScript, but you probably don't see it often — before ES6, it was basically useless. Not anymore!</li>
<li>Ask what the output would be. DON'T open the console first.</li>
</ol>
</aside>
</section>-->
<section>
<h2>
<em>Let</em> and
<em>Const</em> keywords</h2>
<ul>
<li class="fragment">Block-scoped
<code>{ }</code>, unlike the function-scoped
<code>var</code>
</li>
<li class="fragment">
<code>Let</code>
<span class="green">can</span> be reassigned
<ul>
<li>New way to declare variables</li>
</ul>
</li>
<li class="fragment">
<code>Const</code>
<span class="green">cannot</span> be reassigned
<ul>
<li>Const stands for constant</li>
<li>Must be initialized on declaration</li>
<li>But... Complex values can be changed
<p class="fragment">
<img src="dist/img/const-bindings__step4.gif" alt="const bindings and reassignments" />
</p>
</li>
</ul>
</li>
</ul>
<aside class="notes">
Const doesn't hold a constant array/object. Rather, it holds a constant reference to the array/object. The array/object itself
is freely mutable. A const binding that references an object can’t later reference a different value, but the underlying
object can indeed mutate.
</aside>
</section>
<!--<section>
<h2>The <em>let</em> Declaration</h2>
<ul>
<li class="fragment"><span class="blue">Block-scoped</span> <code>{ }</code>, unlike the function-scoped <code>var</code>
</li>
<li class="fragment">Value <span class="green">can</span> be reassigned</li>
</ul>
<div class="fragment" style="min-height:200px;">
<p data-height="200" data-theme-id="dark" data-slug-hash="WjxBLy" data-default-tab="js,result" data-user="anythingcodes" data-embed-version="2" data-pen-title="Block-scoping with let (Before)" class="codepen">See the Pen <a href="http://codepen.io/anythingcodes/pen/WjxBLy/">Block-scoping with let (Before)</a> by Liz Shaw (<a href="http://codepen.io/anythingcodes">@anythingcodes</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<a class="solution solution__lesson-1" href="http://codepen.io/anythingcodes/pen/WjxVQb?editors=0011" target="_blank">View Solution</a>
</div>
<p class="fragment">Way easier than using an IIFE! 🏆</p>
<aside class="notes">
Doesn't have to use a function or IIFE to create a new scope
</aside>
</section>-->
<section class="activity" data-background="rgb(6, 116, 123)">
<h2>Activity</h2>
<p>Instructions can be found by editing the below pen on CodePen. Be sure to fork the pen first if you'd like to save your
work to your account!</p>
<div class="clear">
<div class="halfblock" style="min-height: 280px;">
<h3>Activity 1</h3>
<p data-height="280" data-theme-id="dark" data-slug-hash="OmYGzQ" data-default-tab="js" data-user="anythingcodes" data-embed-version="2"
data-pen-title="Block-scoping" class="codepen">See the Pen
<a href="http://codepen.io/anythingcodes/pen/OmYGzQ/">Block-scoping</a> by Liz Shaw (
<a href="http://codepen.io/anythingcodes">@anythingcodes</a>) on
<a href="http://codepen.io">CodePen</a>.</p>
<a class="solution solution__lesson-1" href="http://codepen.io/anythingcodes/pen/zwQXRY?editors=0012" target="_blank">View Solution</a>
</div>
<div class="halfblock" style="min-height: 280px;">
<h3>Activity 2</h3>
<p data-height="280" data-theme-id="dark" data-slug-hash="LyZwRr" data-default-tab="js" data-user="anythingcodes" data-embed-version="2"
data-pen-title="Block-scoping with let (Before)" class="codepen">See the Pen
<a href="http://codepen.io/anythingcodes/pen/LyZwRr/">Block-scoping with let (Before)</a> by Liz Shaw (
<a href="http://codepen.io/anythingcodes">@anythingcodes</a>) on
<a href="http://codepen.io">CodePen</a>.</p>
<a class="solution solution__lesson-1" href="http://codepen.io/anythingcodes/pen/OmXKRK?editors=0011" target="_blank">View Solution</a>
</div>
</div>
<aside class="notes">
<ul>
<li>A common interview question. Essentially happening because there's only one
<code>i</code> in the outer scope that was closed over, instead of a new
<code>i</code> for each iteration's function to close over.</li>
</ul>
</aside>
</section>
<!--<section>
<h2>The <em>const</em> Declaration</h2>
<ul>
<li class="fragment"><span class="blue">Block-scoped</span>, like <code>let</code></li>
<li class="fragment">Value <span style="color:red;">cannot</span> be changed by reassignment
<ul>
<li class="fragment"><code>const</code> stands for <span class="orange">constant</span></li>
</ul>
</li>
<li class="fragment">Must be initialized on declaration</li>
<li class="fragment">Communicates your variable's intent to other devs</li>
<li class="fragment">Helps catch unintended changes</li>
<li class="fragment">No more <pre style="display: inline-block"><code class="javascript">var PLZ_DONT_CHANGE = 42;</code></pre>🎉</li>
</ul>
<p> </p>
<div class="fragment">
<p data-height="120" data-theme-id="dark" data-slug-hash="bWwbKa" data-default-tab="js,result" data-user="anythingcodes" data-embed-version="2" data-pen-title="const (Before)" class="codepen">See the Pen <a href="https://codepen.io/anythingcodes/pen/bWwbKa/">const (Before)</a> by Liz Shaw (<a href="http://codepen.io/anythingcodes">@anythingcodes</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<a class="solution solution__lesson-1" href="https://codepen.io/anythingcodes/pen/jmMNpK?editors=0010" target="_blank">View Solution</a>
</div>
<aside class="notes">
Change the CodePen on screen
</aside>
</section>
<section>
<h2>Modifying Complex Values</h2>
<p class="fragment">
Although you can't <span class="orange">reassign</span> a <code>const</code>'s value, <span class="green">contents of complex values</span> (objects & arrays) <strong>can</strong> be modified</p>
<div class="fragment-progression">
<p class="fragment"><img src="dist/img/const-bindings__step1.gif" alt="const bindings and reassignments" /></p>
<p class="fragment">
<img src="dist/img/const-bindings__step2.gif" alt="const bindings and reassignments" />
</p>
<p class="fragment">
<img src="dist/img/const-bindings__step3.gif" alt="const bindings and reassignments" />
</p>
<p class="fragment">
<img src="dist/img/const-bindings__step4.gif" alt="const bindings and reassignments" />
</p>
<p class="fragment">
<img src="dist/img/const-bindings__step5.gif" alt="const bindings and reassignments" />
</p>
</div>
<aside class="notes">
The variable doesn't hold a constant array/object. Rather, it holds a constant reference to the array/object. The array/object itself is freely mutable. A const binding that references an object can’t later reference a different value, but the underlying object can indeed mutate.
</aside>
</section>
<section>
<h2>Modifying Complex Values</h2>
<h3>Examples</h3>
<p data-height="280" data-theme-id="dark" data-slug-hash="WjGeaJ" data-default-tab="js" data-user="anythingcodes" data-embed-version="2" data-pen-title="Updating the contents of const values" class="codepen">See the Pen <a href="http://codepen.io/anythingcodes/pen/WjGeaJ/">Updating the contents of const values</a> by Liz Shaw (<a href="http://codepen.io/anythingcodes">@anythingcodes</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<aside class="notes">
The variable doesn't hold a constant array/object. Rather, it holds a constant <strong>reference</strong> to the array/object. The array/object itself is freely mutable.
</aside>
</section>-->
<section>
<h2>Do you still need
<code>var</code>?</h2>
<ul>
<li>Most popular answer is no, but how do you decide?</li>
<li>Use your team's style guide</li>
<li>Use a popular style like like
<a href="https://github.com/airbnb/javascript#references" target="_blank">Airbnb</a>:
<ul>
<li>avoid var</li>
<li>use const unless you need to reassign</li>
</ul>
</li>
</ul>
<aside class="notes">
Reality is that ES6 has brought much-needed functionality to the table. Block-scoping is a game-changer. Huge benefit to
const/let is that they do not pollute your global scope (
<code>window</code> in browsers). Much safer.
</aside>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em;">Linters</h1>
</section>
<section>
<h2>What is a linter?</h2>
<ul>
<li>Parser that analyzes your code and looks for mistakes</li>
<li>Can help you:
<ul>
<li>Develop faster</li>
<li>Keep your code organized</li>
<li>Make fewer syntax errors</li>
</ul>
</li>
<li>Enforces your team's coding style and makes your code easier to read</li>
</ul>
</section>
<section class="activity" data-background="rgb(6, 116, 123)">
<h2>ESLint Demo</h2>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em;">Template Strings</h1>
</section>
<!--<section>
<h2>String Helper Methods</h2>
<p>Step aside, <code>indexOf()</code> — there are now easier ways to identify substrings:</p>
<ol>
<li class="fragment"><code>includes()</code> returns <span class="green">true</span> or <span class="green">false</span> depending on if the given text is found anywhere within the string</li>
<li class="fragment"><code>startsWith()</code> returns <span class="green">true</span> or <span class="green">false</span> depending on if the given text is found at the beginning of the string</li>
<li class="fragment"><code>endsWith()</code> returns <span class="green">true</span> or <span class="green">false</span> depending on if the given text is found at the end of the string</li>
</ol>
</section>
<section>
<h2>String Helper Methods</h2>
<p class="fragment">Each method accepts two arguments:</p>
<ol>
<li class="fragment">the <span class="green">text to search for</span></li>
<li class="fragment">an <span class="green">optional index</span> from which to start the search
<ul>
<li class="small fragment"><code>includes()</code> and <code>startsWith()</code> <span class="orange">include</span> the character at that index, while <code>endsWith()</code> <span class="orange">excludes</span> the character at that index</li>
</ul>
</li>
</ol>
<div class="fragment" style="min-height: 300px;">
<p data-height="270" data-theme-id="0" data-slug-hash="aWWJPZ" data-default-tab="js" data-user="anythingcodes" data-embed-version="2" data-pen-title="String helper methods: includes(), startsWith(), endsWith()" class="codepen">See the Pen <a href="https://codepen.io/anythingcodes/pen/aWWJPZ/">String helper methods: includes(), startsWith(), endsWith()</a> by Liz Shaw (<a href="http://codepen.io/anythingcodes">@anythingcodes</a>) on <a href="http://codepen.io">CodePen</a>.</p>
</div>
<aside class="notes">Case sensitivity still matters. We aren't going to do any exercises around these, but they're included for reference. Good to be aware of. The only thing to note is how the index is handled in <code>endsWith()</code></aside>
</section>-->
<section>
<h2>Template Strings</h2>
<p>Allow multi-line strings</p>
<p>Great for use with HTML
<span class="orange">templates</span>
</p>
<div class="clear">
<div class="halfblock fragment">
<h3 class="green underlined">ES5:</h3>
<pre><code class="xml">'<div>' +
'<h1>Hello ' + str + '!</h1>' +
'</div>';</code></pre>
<p class="right small fragment">becomes</p>
</div>
<div class="halfblock fragment">
<h3 class="green underlined">ES6:</h3>
<pre><code class="xml">`<div>
<h1>Hello ${str}!</h1>
</div>`;</code></pre>
</div>
</div>
<aside class="notes">Ask who's used the ES5 version and gotten confused about plus signs, quotation marks, etc. when adding variables</aside>
</section>
<section>
<h2>Using Template Strings</h2>
<pre><code class="javascript">const message = `User ${name} scored ${score} on the exam`;</code></pre>
<p> </p>
<ul>
<li>Use backticks (
<code>` `</code>) around the string</li>
<li class="fragment">Use
<code>${ }</code> around any
<span class="orange">variable</span> or
<span class="orange">expression</span>
</li>
<li class="fragment">Work well with
<span class="green">ternary operators</span>, for example
<br />
<code class="javascript">${ userIsYoungerThan21 ? serveGrapeJuice() : serveWine() }</code>
</li>
</ul>
<p> </p>
<pre class="fragment small"><code class="javascript">const message = `User ${name} ${score >= 60 ? 'passed' : 'failed'} the exam`;</code></pre>
<aside class="notes">
Can't use
<code>if</code> because that's a statement, not an expression. Ternary operators are expressions.
</aside>
</section>
<section class="activity" data-background="rgb(6, 116, 123)">
<h2>Activity</h2>
<p>Refactor this code to use template strings.</p>
<div style="min-height: 300px">
<p data-height="300" data-theme-id="0" data-slug-hash="MmmoWo" data-default-tab="js,result" data-user="anythingcodes" data-embed-version="2"
data-pen-title="Template Strings Activity" class="codepen">See the Pen
<a href="https://codepen.io/anythingcodes/pen/MmmoWo/">Template Strings Activity</a> by Liz Shaw (
<a href="http://codepen.io/anythingcodes">@anythingcodes</a>) on
<a href="http://codepen.io">CodePen</a>.</p>
</div>
<a href="http://codepen.io/anythingcodes/pen/EmMdqG" target="_blank" class="solution__lesson-1 solution">View Solution</a>
<aside class="notes">Focus on the
<code>html</code> variable</aside>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em;">Enhanced Object Literals</h1>
<aside class="notes">ES6 has a few minor changes to make code more understandable/easy-to-read</aside>
</section>
<section>
<h2>Property Initializer Shorthand</h2>
<p>When an object property name is the same as the local variable name, you can include the name without a colon and value</p>
<div class="clear small">
<div class="halfblock fragment">
<h3 class="green underlined">ES5:</h3>
<pre><code class="javascript">function saveData(url, data){
$.ajax({ method: 'POST', url: url, data: data });
}</code></pre>
<p class="right small fragment">becomes</p>
</div>
<div class="halfblock fragment">
<h3 class="green underlined">ES6:</h3>
<pre><code class="javascript">function saveData(url, data){
$.ajax({ url, data, method: 'POST' });
}</code></pre>
</div>
</div>
<p class="fragment">Sometimes referred to as
<span class="green">enhanced literal notation</span>
</p>
<aside class="notes">Convention is to place shorthanded properties at beginning for readability. This example uses jQuery, but you don't need
to know it; it's just an example.</aside>
</section>
<section>
<h2>Concise methods</h2>
<p class="fragment">Object methods no longer need
<code>: function</code>
</p>
<div class="clear">
<div class="halfblock fragment">
<h3 class="green underlined">ES5:</h3>
<pre><code class="javascript" contenteditable>var dog = {
name: 'Boo',
bark: function() {
console.log('yip!');
}
};
dog.bark(); // yip!</code></pre>
<p class="right small fragment">becomes</p>
</div>
<div class="halfblock fragment">
<h3 class="green underlined">ES6:</h3>
<pre><code class="javascript">const dog = {
name: 'Boo',
bark() {
console.log('yip!');
}
};
dog.bark(); // yip!</code></pre>
</div>
</div>
<aside class="notes">Reformat ES5 version in front of students</aside>
</section>
<section class="activity" data-background="rgb(6, 116, 123)">
<h2>Activity</h2>
<h3>Using Enhanced Object Syntax</h3>
<p data-height="265" data-theme-id="0" data-slug-hash="OgJOzd" data-default-tab="js" data-user="anythingcodes" data-embed-version="2"
data-pen-title="Object Syntax" class="codepen">See the Pen
<a href="https://codepen.io/anythingcodes/pen/OgJOzd/">Object Syntax</a> by Liz Shaw (
<a href="https://codepen.io/anythingcodes">@anythingcodes</a>) on
<a href="https://codepen.io">CodePen</a>.</p>
<a class="solution solution__lesson-3" href="https://codepen.io/anythingcodes/pen/awbVqW?editors=0012" target="_blank">View Solution</a>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em;">Classes</h1>
</section>
<section>
<h2>Classes</h2>
<div class="clear">
<div class="halfblock fragment">
<h3 class="green underlined">ES5:</h3>
<pre class="small"><code class="javascript">function Vehicle(type) {
this.type = type;
}
Vehicle.prototype.logType = function() {
console.log(this.type);
};
var car = new Vehicle('car');
car.logType(); // 'car'
console.log(car instanceof Vehicle); // true
console.log(car instanceof Object); // true
</code></pre>
</div>
<div class="halfblock fragment">
<h3 class="green underlined">ES6:</h3>
<pre class="small"><code class="javascript">class Vehicle {
constructor(type) {
this.type = type;
}
logType() {
console.log(this.type);
}
}
const car = new Vehicle('car');
car.logType(); // 'car'
console.log(car instanceof Vehicle); // true
console.log(car instanceof Object); // true
</code></pre>
</div>
</div>
<p> </p>
<p class="small fragment green info">You don't need commas between the elements of a class</p>
<aside class="notes">In ES5, we only had class-like structures. Involved creating a constructor and assigning methods to the constructor's
prototype, an approach commonly referred to as creating a custom type. Why use classes?
<ul>
<li>Class declarations, unlike function declarations, are not
<span class="orange">hoisted</span>; they behave like
<code>let</code> declarations</li>
<li>All code inside class declarations runs in strict mode automatically</li>
<li>Calling the class constructor without
<code>new</code> throws an error</li>
<li>Attempting to overwrite the class name within a class method throws an error</li>
</ul>
</aside>
</section>
<section>
<h2>Derived Classes</h2>
<p class="fragment small">
<span class="blue">Derived classes</span>: Classes that inherit from other classes</p>
<p class="fragment small">Within the derived class's
<code>class {}</code> definition, use the
<code>extends</code> keyword to specify the base class. Then access the base class constructor by calling
<code>super()</code>.</p>
<pre class="fragment small"><code class="javascript">class Rectangle {
constructor(length, width) {
this.length = length;
this.width = width;
}
getArea() {
return this.length * this.width;
}
}
</code></pre>
<pre class="fragment small"><code class="javascript">class Square extends Rectangle {
constructor(length) {
super(length, length); // calls the base class constructor
}
}
const square = new Square(5);
console.log(square.getArea()); // 25
</code></pre>
<aside class="notes">
Inheritance -- no true object inheritance, but there is prototypal inheritance. If you ask 5 different engineers how it works,
you’ll get 5 different answers. This is ES6’s solution to prototypal inheritance. Whenever you use a class, under the
hood, you’re still using prototypal inheritance.
</aside>
</section>
<section class="activity" data-background="rgb(6, 116, 123)">
<h2>Activity</h2>
<p>Classes and Derived Classes</p>
<div class="clear">
<div class="halfblock" style="min-height:265px">
<h3>Activity 1</h3>
<p data-height="265" data-theme-id="0" data-slug-hash="WOwEMY" data-default-tab="js" data-user="anythingcodes" data-embed-version="2"
data-pen-title="Classes" class="codepen">See the Pen
<a href="https://codepen.io/anythingcodes/pen/WOwEMY/">Classes</a> by Liz Shaw (
<a href="https://codepen.io/anythingcodes">@anythingcodes</a>) on
<a href="https://codepen.io">CodePen</a>.</p>
<p>
<a href="https://codepen.io/anythingcodes/pen/vZGJRJ?editors=0011" target="_blank" class="solution solution__lesson-4">View Solution</a>
</p>
</div>
<div class="halfblock" style="min-height:265px">
<h3>Activity 2</h3>
<p data-height="265" data-theme-id="0" data-slug-hash="EXKyOJ" data-default-tab="js" data-user="anythingcodes" data-embed-version="2"
data-pen-title="Shop Activity - Classes and Derived Classes" class="codepen">See the Pen
<a href="https://codepen.io/anythingcodes/pen/EXKyOJ/">Shop Activity - Classes and Derived Classes</a> by Liz Shaw (
<a href="https://codepen.io/anythingcodes">@anythingcodes</a>) on
<a href="https://codepen.io">CodePen</a>.</p>
<a href="https://codepen.io/anythingcodes/pen/YQqWdw?editors=0010" target="_blank" class="solution solution__lesson-4">View Solution</a>
</div>
</div>
</section>