-
Notifications
You must be signed in to change notification settings - Fork 0
/
ES6.html
1430 lines (1294 loc) · 62.8 KB
/
ES6.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
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
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<style type="text/css">
@import url(https://themes.googleusercontent.com/fonts/css?kit=lhDjYqiy3mZ0x6ROQEUoUw);
ul.lst-kix_8uj8m6d8vb2y-2 {
list-style-type: none
}
ul.lst-kix_8uj8m6d8vb2y-3 {
list-style-type: none
}
ul.lst-kix_8uj8m6d8vb2y-4 {
list-style-type: none
}
ul.lst-kix_8uj8m6d8vb2y-5 {
list-style-type: none
}
ul.lst-kix_hl56l1z5s65i-5 {
list-style-type: none
}
ul.lst-kix_hl56l1z5s65i-6 {
list-style-type: none
}
ul.lst-kix_hl56l1z5s65i-7 {
list-style-type: none
}
ul.lst-kix_8uj8m6d8vb2y-0 {
list-style-type: none
}
ul.lst-kix_hl56l1z5s65i-8 {
list-style-type: none
}
ul.lst-kix_8uj8m6d8vb2y-1 {
list-style-type: none
}
.lst-kix_hl56l1z5s65i-2>li:before {
content: "\0025a0 "
}
.lst-kix_hl56l1z5s65i-1>li:before {
content: "\0025cb "
}
.lst-kix_y8e19wjyonu6-0>li:before {
content: "\0025cf "
}
.lst-kix_hl56l1z5s65i-0>li:before {
content: "\0025cf "
}
.lst-kix_hl56l1z5s65i-3>li:before {
content: "\0025cf "
}
.lst-kix_hl56l1z5s65i-4>li:before {
content: "\0025cb "
}
.lst-kix_hl56l1z5s65i-5>li:before {
content: "\0025a0 "
}
.lst-kix_hl56l1z5s65i-6>li:before {
content: "\0025cf "
}
.lst-kix_hl56l1z5s65i-8>li:before {
content: "\0025a0 "
}
ul.lst-kix_8uj8m6d8vb2y-6 {
list-style-type: none
}
ul.lst-kix_8uj8m6d8vb2y-7 {
list-style-type: none
}
ul.lst-kix_8uj8m6d8vb2y-8 {
list-style-type: none
}
.lst-kix_hl56l1z5s65i-7>li:before {
content: "\0025cb "
}
ul.lst-kix_y8e19wjyonu6-0 {
list-style-type: none
}
ul.lst-kix_y8e19wjyonu6-1 {
list-style-type: none
}
ul.lst-kix_y8e19wjyonu6-2 {
list-style-type: none
}
ul.lst-kix_y8e19wjyonu6-3 {
list-style-type: none
}
ul.lst-kix_y8e19wjyonu6-4 {
list-style-type: none
}
ul.lst-kix_y8e19wjyonu6-5 {
list-style-type: none
}
ul.lst-kix_y8e19wjyonu6-6 {
list-style-type: none
}
ul.lst-kix_y8e19wjyonu6-7 {
list-style-type: none
}
ul.lst-kix_y8e19wjyonu6-8 {
list-style-type: none
}
.lst-kix_8uj8m6d8vb2y-4>li:before {
content: "\0025cb "
}
.lst-kix_8uj8m6d8vb2y-5>li:before {
content: "\0025a0 "
}
.lst-kix_y8e19wjyonu6-3>li:before {
content: "\0025cf "
}
.lst-kix_y8e19wjyonu6-5>li:before {
content: "\0025a0 "
}
.lst-kix_8uj8m6d8vb2y-2>li:before {
content: "\0025a0 "
}
.lst-kix_8uj8m6d8vb2y-3>li:before {
content: "\0025cf "
}
.lst-kix_8uj8m6d8vb2y-6>li:before {
content: "\0025cf "
}
.lst-kix_8uj8m6d8vb2y-7>li:before {
content: "\0025cb "
}
.lst-kix_y8e19wjyonu6-4>li:before {
content: "\0025cb "
}
.lst-kix_y8e19wjyonu6-8>li:before {
content: "\0025a0 "
}
.lst-kix_8uj8m6d8vb2y-0>li:before {
content: "\0025cf "
}
.lst-kix_8uj8m6d8vb2y-1>li:before {
content: "\0025cb "
}
.lst-kix_8uj8m6d8vb2y-8>li:before {
content: "\0025a0 "
}
.lst-kix_y8e19wjyonu6-1>li:before {
content: "\0025cb "
}
li.li-bullet-0:before {
margin-left: -18pt;
white-space: nowrap;
display: inline-block;
min-width: 18pt
}
.lst-kix_y8e19wjyonu6-2>li:before {
content: "\0025a0 "
}
ul.lst-kix_hl56l1z5s65i-1 {
list-style-type: none
}
ul.lst-kix_hl56l1z5s65i-2 {
list-style-type: none
}
ul.lst-kix_hl56l1z5s65i-3 {
list-style-type: none
}
ul.lst-kix_hl56l1z5s65i-4 {
list-style-type: none
}
.lst-kix_y8e19wjyonu6-7>li:before {
content: "\0025cb "
}
ul.lst-kix_hl56l1z5s65i-0 {
list-style-type: none
}
.lst-kix_y8e19wjyonu6-6>li:before {
content: "\0025cf "
}
ol {
margin: 0;
padding: 0
}
table td,
table th {
padding: 0
}
.c15 {
border-right-style: solid;
padding: 5pt 5pt 5pt 5pt;
border-bottom-color: #000000;
border-top-width: 0pt;
border-right-width: 0pt;
border-left-color: #000000;
vertical-align: top;
border-right-color: #000000;
border-left-width: 0pt;
border-top-style: solid;
background-color: #333333;
border-left-style: solid;
border-bottom-width: 0pt;
width: 468pt;
border-top-color: #000000;
border-bottom-style: solid
}
.c14 {
background-color: #ffffff;
margin-left: 36pt;
padding-top: 11pt;
padding-left: 0pt;
padding-bottom: 11pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: left
}
.c7 {
background-color: #ffffff;
color: #000000;
font-weight: 400;
text-decoration: none;
vertical-align: baseline;
font-size: 11.5pt;
font-family: "Verdana";
font-style: normal
}
.c11 {
background-color: #ffffff;
padding-top: 8pt;
padding-bottom: 8pt;
line-height: 1.5;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
.c10 {
color: #000000;
font-weight: 400;
text-decoration: none;
vertical-align: baseline;
font-size: 11.5pt;
font-family: "Verdana";
font-style: normal
}
.c18 {
background-color: #ffffff;
padding-top: 14pt;
padding-bottom: 14pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: left
}
.c6 {
color: #000000;
font-weight: 400;
text-decoration: none;
vertical-align: baseline;
font-size: 12pt;
font-family: "Arial";
font-style: normal
}
.c17 {
background-color: #ffffff;
padding-top: 8pt;
padding-bottom: 8pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: left
}
.c1 {
padding-top: 0pt;
padding-bottom: 0pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: left;
height: 11pt
}
.c13 {
-webkit-text-decoration-skip: none;
color: #1155cc;
font-weight: 400;
text-decoration: underline;
text-decoration-skip-ink: none;
font-size: 11.5pt;
font-family: "Verdana"
}
.c0 {
color: #000000;
font-weight: 400;
text-decoration: none;
vertical-align: baseline;
font-size: 11pt;
font-family: "Arial";
font-style: normal
}
.c33 {
padding-top: 11pt;
padding-bottom: 11pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: left
}
.c28 {
padding-top: 8pt;
padding-bottom: 8pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: left;
}
.c36 {
padding-top: 14pt;
padding-bottom: 14pt;
line-height: 1.5;
orphans: 2;
widows: 2;
text-align: left
}
.c57 {
padding-top: 12pt;
padding-bottom: 12pt;
line-height: 1.5;
text-align: left;
height: 11pt
}
.c3 {
background-color: #ffffcc;
font-size: 12pt;
font-family: "Courier New";
color: #dc143c;
font-weight: 400
}
.c9 {
background-color: #333333;
font-size: 10pt;
font-family: "Consolas";
color: #ffffff;
font-weight: 400
}
.c34 {
color: #999999;
font-weight: 400;
text-decoration: none;
font-size: 11.5pt;
font-family: "Courier New"
}
.c39 {
background-color: #333333;
font-size: 10pt;
font-family: "Consolas";
color: #a2fca2;
font-weight: 400
}
.c12 {
background-color: #333333;
font-size: 10pt;
font-family: "Consolas";
color: #d36363;
font-weight: 400
}
.c62 {
-webkit-text-decoration-skip: none;
color: #1155cc;
text-decoration: underline;
text-decoration-skip-ink: none;
font-size: 17pt
}
.c29 {
color: #990055;
font-weight: 400;
text-decoration: none;
font-size: 10pt;
font-family: "Courier New"
}
.c20 {
background-color: #333333;
font-size: 10pt;
font-family: "Consolas";
color: #ffffaa;
font-weight: 400
}
.c4 {
background-color: #333333;
font-size: 10pt;
font-family: "Consolas";
color: #fcc28c;
font-weight: 400
}
.c30 {
color: #999999;
font-weight: 400;
text-decoration: none;
font-size: 10pt;
font-family: "Courier New"
}
.c45 {
background-color: #333333;
font-size: 10pt;
font-family: "Consolas";
color: #888888;
font-weight: 400
}
.c2 {
padding-top: 0pt;
padding-bottom: 0pt;
line-height: 1.15;
text-align: left
}
.c56 {
padding-top: 8pt;
padding-bottom: 8pt;
line-height: 1.5;
text-align: left
}
.c49 {
color: #999999;
font-weight: 400;
font-size: 10pt;
font-family: "Arial"
}
.c23 {
padding-top: 3pt;
padding-bottom: 0pt;
line-height: 1.0;
text-align: left
}
.c19 {
border-spacing: 0;
border-collapse: collapse;
margin-right: auto
}
.c31 {
font-size: 12pt;
font-family: "Courier New";
color: #dc143c;
font-weight: 400
}
.c58 {
padding-top: 0pt;
padding-bottom: 4pt;
line-height: 1.5;
text-align: left
}
.c41 {
font-weight: 400;
font-size: 18pt;
font-family: "Arial"
}
.c21 {
font-size: 11.5pt;
font-family: "Verdana";
font-weight: 400
}
.c48 {
font-weight: 400;
font-size: 11.5pt;
font-family: "Courier New"
}
.c42 {
font-size: 12pt;
font-family: "Courier New";
font-weight: 400
}
.c50 {
color: #515151;
font-size: 17pt;
font-family: "Arial"
}
.c64 {
background-color: #333333;
font-family: "Consolas";
color: #c6b4f0
}
.c37 {
font-weight: 400;
font-size: 10pt;
font-family: "Verdana"
}
.c46 {
font-weight: 400;
font-size: 24pt;
font-family: "Arial"
}
.c43 {
font-size: 11pt;
font-family: "Arial"
}
.c27 {
vertical-align: baseline;
font-style: italic
}
.c44 {
orphans: 2;
widows: 2
}
.c55 {
padding: 0;
margin: 0
}
.c51 {
font-family: "Courier New";
font-weight: 400
}
.c54 {
font-weight: 400;
font-family: "Arial"
}
.c5 {
color: inherit;
text-decoration: inherit
}
.c60 {
max-width: 468pt;
padding: 72pt 72pt 72pt 72pt
}
.c22 {
color: #000000;
text-decoration: none
}
.c25 {
vertical-align: baseline;
font-style: normal
}
.c52 {
margin-left: 36pt
}
.c53 {
font-style: italic
}
.c16 {
font-weight: 700
}
.c40 {
text-decoration: none
}
.c24 {
background-color: #ffffcc
}
.c65 {
page-break-after: avoid
}
.c63 {
font-weight: 400
}
.c32 {
color: #434343
}
.c35 {
margin-left: 72pt
}
.c26 {
background-color: #ffffff
}
.c8 {
height: 0pt
}
.c47 {
font-size: 20pt
}
.c59 {
background-color: #ffff00
}
.c38 {
margin-left: 18pt
}
.c61 {
font-size: 10pt
}
.title {
padding-top: 0pt;
color: #000000;
font-size: 26pt;
padding-bottom: 3pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
.subtitle {
padding-top: 0pt;
color: #666666;
font-size: 15pt;
padding-bottom: 16pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
li {
color: #000000;
font-size: 11pt;
font-family: "Arial"
}
p {
margin: 0;
color: #000000;
font-size: 11pt;
font-family: "Arial"
}
h1 {
background-color: #ffffff;
padding-top: 8pt;
color: #434343;
font-size: 18pt;
padding-bottom: 8pt;
font-family: "Arial";
line-height: 1.5;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h2 {
padding-top: 18pt;
color: #000000;
font-size: 16pt;
padding-bottom: 6pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h3 {
padding-top: 16pt;
color: #434343;
font-size: 14pt;
padding-bottom: 4pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h4 {
padding-top: 14pt;
color: #666666;
font-size: 12pt;
padding-bottom: 4pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h5 {
padding-top: 12pt;
color: #666666;
font-size: 11pt;
padding-bottom: 4pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h6 {
padding-top: 12pt;
color: #666666;
font-size: 11pt;
padding-bottom: 4pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
font-style: italic;
orphans: 2;
widows: 2;
text-align: left
}
</style>
</head>
<body class="c26 c60 doc-content">
<p class="c1"><span class="c0"></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.t0l2j3ieeolb">React
ES6 </a></span><span class="c16"><a class="c5"
href="#h.t0l2j3ieeolb">2</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5" href="#h.eluavfjuj8pt">Why Should I Learn
ES6? </a></span><span><a class="c5"
href="#h.eluavfjuj8pt">2</a></span></p>
<p class="c23"><span class="c16 c22"><a class="c5" href="#h.kz0i0zr2asjy">ES6
Classes </a></span><span class="c16"><a class="c5"
href="#h.kz0i0zr2asjy">2</a></span></p>
<p class="c23 c35"><span class="c22"><a class="c5"
href="#h.gj90k5kueeuj">example </a></span><span><a
class="c5" href="#h.gj90k5kueeuj">2</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5" href="#h.781b4bnyfiyr">Class
Inheritance </a></span><span><a class="c5"
href="#h.781b4bnyfiyr">3</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.4ip5v9915pq7">ES6 Arrow
Functions </a></span><span class="c16"><a class="c5"
href="#h.4ip5v9915pq7">5</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.lk0u2d3dvz53">If you have parameters, you pass them
inside the parentheses: </a></span><span class="c16"><a
class="c5" href="#h.lk0u2d3dvz53">5</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5" href="#h.wiphuingx3ot">What About
this? </a></span><span><a class="c5"
href="#h.wiphuingx3ot">5</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.je5hm3uqmj7w">ES6
Variables </a></span><span class="c16"><a class="c5"
href="#h.je5hm3uqmj7w">6</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.1auvvi1vyjgj">ES6 Array
Methods </a></span><span class="c16"><a class="c5"
href="#h.1auvvi1vyjgj">7</a></span></p>
<p class="c23 c52"><span class="c22"><a class="c5"
href="#h.q4l59vm7nv3f">Example </a></span><span><a
class="c5" href="#h.q4l59vm7nv3f">7</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.7nxsxetxutyv">ES6
Destructuring </a></span><span class="c16"><a class="c5"
href="#h.7nxsxetxutyv">8</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5" href="#h.z1fvoqys63yz">Destructing
Arrays </a></span><span><a class="c5"
href="#h.z1fvoqys63yz">8</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.ou8d8jmtg34j">If we only want the car and suv we can
simply leave out the truck but keep the
comma: </a></span><span class="c16"><a class="c5"
href="#h.ou8d8jmtg34j">8</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5" href="#h.h22blgyenkxe">Destructuring
Objects </a></span><span><a class="c5"
href="#h.h22blgyenkxe">9</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.8fw7dpglggug">ES6 Spread
Operator </a></span><span class="c16"><a class="c5"
href="#h.8fw7dpglggug">10</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.obl4y3lji83t">We can use the spread operator with
objects too: </a></span><span class="c16"><a class="c5"
href="#h.obl4y3lji83t">10</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.bc9ifvuckxt1">ES6
Modules </a></span><span class="c16"><a class="c5"
href="#h.bc9ifvuckxt1">10</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5"
href="#h.h7vf387edbdz">Export </a></span><span><a
class="c5" href="#h.h7vf387edbdz">11</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5" href="#h.vzxsbiapgwo0">Named
Exports </a></span><span><a class="c5"
href="#h.vzxsbiapgwo0">11</a></span></p>
<p class="c23 c52"><span class="c22"><a class="c5" href="#h.l48d6af64o0w">All at once at the
bottom: </a></span><span><a class="c5"
href="#h.l48d6af64o0w">11</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5" href="#h.2zgw9tanbq3s">Default
Exports </a></span><span><a class="c5"
href="#h.2zgw9tanbq3s">11</a></span></p>
<p class="c23 c38"><span class="c22"><a class="c5"
href="#h.xb4tmdewsosf">Import </a></span><span><a
class="c5" href="#h.xb4tmdewsosf">12</a></span></p>
<p class="c23"><span class="c22 c16"><a class="c5" href="#h.qvdfijuctouv">ES6 Ternary
Operator </a></span><span class="c16"><a class="c5"
href="#h.qvdfijuctouv">12</a></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c1"><span class="c0"></span></p>
<h1 class="c11" id="h.t0l2j3ieeolb"><span class="c41 c25 c40 c32 c26">React ES6</span></h1>
<p class="c1"><span class="c0"></span></p>
<p class="c2 c44"><span class="c0">ES6 stands for ECMAScript 6.</span></p>
<p class="c1"><span class="c0"></span></p>
<p class="c2 c44"><span class="c0">ECMAScript was created to standardize JavaScript, and ES6 is the 6th version of
ECMAScript, it was published in 2015, and is also known as ECMAScript 2015.</span></p>
<p class="c1"><span class="c0"></span></p>
<h2 class="c17" id="h.eluavfjuj8pt"><span class="c6">Why Should I Learn ES6?</span></h2>
<p class="c18"><span class="c10">React uses ES6, and you should be familiar with some of the new features
like:</span></p>
<ul class="c55 lst-kix_8uj8m6d8vb2y-0 start">
<li class="c14 li-bullet-0"><span class="c13"><a class="c5"
href="https://www.google.com/url?q=https://www.w3schools.com/REACT/react_es6_classes.asp&sa=D&source=editors&ust=1701100432601694&usg=AOvVaw06iYfheL4hZ9z_VvCgmVQD">Classes</a></span>
</li>
<li class="c14 li-bullet-0"><span class="c13"><a class="c5"
href="https://www.google.com/url?q=https://www.w3schools.com/REACT/react_es6_arrow.asp&sa=D&source=editors&ust=1701100432602105&usg=AOvVaw2mvY4LSExfTU-H4_75BA7N">Arrow
Functions</a></span></li>
<li class="c14 li-bullet-0"><span class="c13"><a class="c5"
href="https://www.google.com/url?q=https://www.w3schools.com/REACT/react_es6_variables.asp&sa=D&source=editors&ust=1701100432602398&usg=AOvVaw30a65-1PTmkR7NbhIuTJQw">Variables</a></span><span
class="c10"> (let, const, var)</span></li>
<li class="c14 li-bullet-0"><span class="c13"><a class="c5"
href="https://www.google.com/url?q=https://www.w3schools.com/REACT/react_es6_array_methods.asp&sa=D&source=editors&ust=1701100432602665&usg=AOvVaw1WBarmZBi6bCQIf75zFmdJ">Array
Methods</a></span><span class="c21"> like </span><span class="c31 c25 c40">.map()</span></li>
<li class="c14 li-bullet-0"><span class="c13"><a class="c5"
href="https://www.google.com/url?q=https://www.w3schools.com/REACT/react_es6_destructuring.asp&sa=D&source=editors&ust=1701100432602963&usg=AOvVaw0UpGXDec78tMW-6aT0Dl0y">Destructuring</a></span>
</li>
<li class="c14 li-bullet-0"><span class="c13"><a class="c5"
href="https://www.google.com/url?q=https://www.w3schools.com/REACT/react_es6_modules.asp&sa=D&source=editors&ust=1701100432603209&usg=AOvVaw0Ut0NoeOPZNGblGdT1uvVj">Modules</a></span>
</li>
<li class="c14 li-bullet-0"><span class="c13"><a class="c5"
href="https://www.google.com/url?q=https://www.w3schools.com/REACT/react_es6_ternary.asp&sa=D&source=editors&ust=1701100432603489&usg=AOvVaw0PWQ1cZd8dXVcQiZ14hC98">Ternary
Operator</a></span></li>
<li class="c14 li-bullet-0"><span class="c13"><a class="c5"
href="https://www.google.com/url?q=https://www.w3schools.com/REACT/react_es6_spread.asp&sa=D&source=editors&ust=1701100432603791&usg=AOvVaw0VZ9ISQ1p1TTFvqnrOyOpU">Spread
Operator</a></span></li>
</ul>
<h1 class="c11" id="h.kz0i0zr2asjy"><span class="c41 c25 c40 c32 c26">ES6 Classes</span></h1>
<p class="c1"><span class="c0"></span></p>
<p class="c2 c44"><span class="c21 c26">A class is a type of function, but instead of using the keyword </span><span
class="c31">function</span><span class="c21 c26"> to initiate it, we use the keyword </span><span
class="c31">class</span><span class="c21 c26">, and the properties are assigned inside a </span><span
class="c31">constructor()</span><span class="c7"> method.</span></p>
<h5 class="c28 c65" id="h.gj90k5kueeuj"><span class="c32">example</span></h5>
<p class="c33"><span class="c21 c26">A simple class constructor:</span></p><a
id="t.7e1d648204071e3447dfe4a08dbb49e49328d69d"></a><a id="t.0"></a>
<table class="c19">
<tr class="c8">
<td class="c15" colspan="1" rowspan="1">
<p class="c2"><span class="c4">class</span><span class="c9"> </span><span
class="c20">Car</span><span class="c9"> {<br> </span><span
class="c4">constructor</span><span class="c9">(name) {<br> </span><span
class="c4">this</span><span class="c9">.brand = name;<br> }<br>}</span></p>
</td>
</tr>
</table>
<p class="c33"><span class="c7">Methods in classes</span></p><a
id="t.046bbd100b9c869e7641495551efc6db3838207a"></a><a id="t.1"></a>
<table class="c19">
<tr class="c8">
<td class="c15" colspan="1" rowspan="1">
<p class="c2"><span class="c4">class</span><span class="c9"> </span><span
class="c20">Car</span><span class="c9"> {<br> </span><span
class="c4">constructor</span><span class="c9">(name) {<br> </span><span
class="c4">this</span><span class="c9">.brand = name;<br> }<br> present() {<br>
</span><span class="c4">return</span><span class="c9"> </span><span
class="c39">'I have a '</span><span class="c9"> + </span><span
class="c4">this</span><span class="c9">.brand;<br> }<br>}<br></span><span
class="c4">const</span><span class="c9"> mycar = </span><span class="c4">new</span><span
class="c9"> Car(</span><span class="c39">"Ford"</span><span
class="c9">);<br>mycar.present();</span></p>
</td>
</tr>
</table>
<p class="c44 c57"><span class="c34 c25 c26"></span></p>
<h1 class="c44 c26 c56" id="h.781b4bnyfiyr"><span class="c25 c40 c32 c26 c41">Class Inheritance</span></h1>
<p class="c36 c26"><span class="c21 c32 c26">To create a class inheritance, use the </span><span
class="c42 c32 c26">extends</span><span class="c21 c25 c40 c32 c26"> keyword.</span></p>
<p class="c36 c26"><span class="c21 c25 c40 c32 c26">A class created with a class inheritance inherits all the
methods from another class:</span></p><a id="t.ed06acf669370179bd1fb4e34389ee334e3598bf"></a><a
id="t.2"></a>
<table class="c19">
<tr class="c8">
<td class="c15" colspan="1" rowspan="1">
<p class="c2"><span class="c4">class</span><span class="c9"> </span><span
class="c20">Car</span><span class="c9"> {<br> </span><span
class="c4">constructor</span><span class="c9">(name) {<br> </span><span
class="c4">this</span><span class="c9">.brand = name;<br> }<br><br> present() {<br>
</span><span class="c4">return</span><span class="c9"> </span><span
class="c39">'I have a '</span><span class="c9"> + </span><span
class="c4">this</span><span class="c9">.brand;<br> }<br>}<br><br></span><span
class="c4">class</span><span class="c9"> </span><span class="c20">Model</span><span
class="c9"> </span><span class="c4">extends</span><span class="c9"> </span><span
class="c20">Car</span><span class="c9"> {<br> </span><span
class="c4">constructor</span><span class="c9">(name, mod) {<br> </span><span
class="c4">super</span><span class="c9">(name);<br> </span><span