1
00:00:02,060 --> 00:00:03,950
Now that's it for this section.

2
00:00:03,950 --> 00:00:08,430
And this was definitely not a small or easy section.

3
00:00:08,430 --> 00:00:10,560
We had lots of new concepts

4
00:00:10,560 --> 00:00:14,360
and it's very likely that you're not 100% on board

5
00:00:14,360 --> 00:00:16,650
with all those concepts yet.

6
00:00:16,650 --> 00:00:19,070
That's totally normal though.

7
00:00:19,070 --> 00:00:20,562
These are a lot of concepts

8
00:00:20,562 --> 00:00:23,800
and pretty advanced concepts too,

9
00:00:23,800 --> 00:00:25,740
but I wanted to get them out of the way,

10
00:00:25,740 --> 00:00:28,970
because we'll see them throughout the rest of the course.

11
00:00:28,970 --> 00:00:31,800
And therefore, of course, as we start using them there,

12
00:00:31,800 --> 00:00:34,420
also in more realistic examples,

13
00:00:34,420 --> 00:00:37,100
things also will become clearer.

14
00:00:37,100 --> 00:00:40,230
It was important to introduce them now though,

15
00:00:40,230 --> 00:00:43,920
so that later sections can focus on different parts

16
00:00:43,920 --> 00:00:47,053
and you have at least seen those concepts already then.

17
00:00:47,890 --> 00:00:50,090
We did learn about functions

18
00:00:50,090 --> 00:00:52,700
and default parameter values,

19
00:00:52,700 --> 00:00:57,040
hence turning these parameters into optional parameters.

20
00:00:57,040 --> 00:01:00,700
And we learned about the rest parameter operator here,

21
00:01:00,700 --> 00:01:05,330
the three dots that allows us to past in a list of values

22
00:01:05,330 --> 00:01:10,330
instead of a fixed number of values or an array.

23
00:01:10,490 --> 00:01:12,580
We also learned about the spread operator,

24
00:01:12,580 --> 00:01:13,940
which is the opposite,

25
00:01:13,940 --> 00:01:17,210
which allows us to pull out all the values off an array

26
00:01:17,210 --> 00:01:21,410
or object in places where a list of values

27
00:01:21,410 --> 00:01:24,440
or a list of key value pairs is needed

28
00:01:24,440 --> 00:01:27,530
instead of the full array or object.

29
00:01:27,530 --> 00:01:30,560
These were some things we learned about functions.

30
00:01:30,560 --> 00:01:33,720
We also learned about that template literal syntax,

31
00:01:33,720 --> 00:01:37,450
which allows us to construct strings with placeholders.

32
00:01:37,450 --> 00:01:40,710
And hence it gives us a way of constructing longer strings

33
00:01:40,710 --> 00:01:43,970
with dynamic values in a more convenient way

34
00:01:43,970 --> 00:01:47,310
than having to concatenate strings and values

35
00:01:47,310 --> 00:01:49,630
with the plus operator.

36
00:01:49,630 --> 00:01:53,420
Now, we also did dive into some behind the scenes things

37
00:01:53,420 --> 00:01:54,810
thereafter.

38
00:01:54,810 --> 00:01:58,410
We had a look at reference where this primitive values

39
00:01:58,410 --> 00:02:01,430
and that objects are reference values,

40
00:02:01,430 --> 00:02:03,470
and that those values are stored

41
00:02:03,470 --> 00:02:05,810
in a special kind of memory,

42
00:02:05,810 --> 00:02:08,880
which actually leads JavaScript to just store

43
00:02:08,880 --> 00:02:10,789
the address of that space

44
00:02:10,789 --> 00:02:13,310
and memory in constants or variables

45
00:02:13,310 --> 00:02:15,900
instead of the value as a whole.

46
00:02:15,900 --> 00:02:20,520
That's why we can edit such values stored in a constant

47
00:02:20,520 --> 00:02:22,420
without facing an error,

48
00:02:22,420 --> 00:02:24,240
because we're not actually editing

49
00:02:24,240 --> 00:02:25,980
the value in the constant,

50
00:02:25,980 --> 00:02:28,430
but the value stored in memory.

51
00:02:28,430 --> 00:02:32,160
The value in the constant is just the address of that value

52
00:02:32,160 --> 00:02:35,383
and memory, and that address didn't change.

53
00:02:36,560 --> 00:02:39,180
We had a look at a couple of related concepts

54
00:02:39,180 --> 00:02:41,450
and you also learned that you can again use

55
00:02:41,450 --> 00:02:45,600
the spread operator to still create copies of objects

56
00:02:45,600 --> 00:02:50,370
or erase with ease in case you need to fully copy an object

57
00:02:50,370 --> 00:02:51,203
or array,

58
00:02:51,203 --> 00:02:54,110
and you don't want to work with that existing object

59
00:02:54,110 --> 00:02:56,450
or array in memory, for example,

60
00:02:56,450 --> 00:03:00,493
to avoid unwanted mutation of that object or array,

61
00:03:00,493 --> 00:03:02,543
as we had it in this example.

62
00:03:04,570 --> 00:03:07,500
We also explored errors.

63
00:03:07,500 --> 00:03:10,050
Error handling is something which matters.

64
00:03:10,050 --> 00:03:12,950
And with try-catch you can handle errors

65
00:03:12,950 --> 00:03:15,210
in a fine grained way

66
00:03:15,210 --> 00:03:19,060
where you have full control over which code might fail

67
00:03:19,060 --> 00:03:21,963
and how you want to handle that failure.

68
00:03:23,070 --> 00:03:26,100
We also had a closer look at objects again.

69
00:03:26,100 --> 00:03:27,477
We explored classes

70
00:03:27,477 --> 00:03:30,630
which allow us to create our own blueprints

71
00:03:30,630 --> 00:03:32,450
for our own objects,

72
00:03:32,450 --> 00:03:35,760
where we can use the constructor to tell JavaScript

73
00:03:35,760 --> 00:03:39,210
how objects based on that class should be created

74
00:03:39,210 --> 00:03:41,660
and which properties they should have.

75
00:03:41,660 --> 00:03:44,150
And we learned that we can add methods.

76
00:03:44,150 --> 00:03:46,814
Here that this keyword is also important

77
00:03:46,814 --> 00:03:51,180
because this keyword gives us access to the object

78
00:03:51,180 --> 00:03:53,040
that's about to be created,

79
00:03:53,040 --> 00:03:56,680
or that was created in case of methods.

80
00:03:56,680 --> 00:03:59,870
And then we can instantiate classes,

81
00:03:59,870 --> 00:04:03,301
create concrete objects based on the blueprint

82
00:04:03,301 --> 00:04:05,970
by executing the class as a function

83
00:04:05,970 --> 00:04:07,913
and adding the new keyword.

84
00:04:09,370 --> 00:04:13,020
Last but not least, but definitely also very important,

85
00:04:13,020 --> 00:04:15,600
we had a look at async code.

86
00:04:15,600 --> 00:04:17,529
And you've learned that some operations

87
00:04:17,529 --> 00:04:19,760
simply can take a bit longer

88
00:04:19,760 --> 00:04:22,120
and therefore you might want to perform them

89
00:04:22,120 --> 00:04:24,029
in an asynchronous way,

90
00:04:24,029 --> 00:04:27,160
either with help of a callback function

91
00:04:27,160 --> 00:04:29,740
or with help of a promise.

92
00:04:29,740 --> 00:04:31,870
And when working with promises,

93
00:04:31,870 --> 00:04:34,310
you can also turn your overall function

94
00:04:34,310 --> 00:04:38,220
that wraps the async code into an async function,

95
00:04:38,220 --> 00:04:40,370
and then use the await keyword

96
00:04:40,370 --> 00:04:44,240
to go back to more synchronous looking code,

97
00:04:44,240 --> 00:04:46,340
even though it's transformed under the hood,

98
00:04:46,340 --> 00:04:47,173
as you learned.

99
00:04:48,210 --> 00:04:52,290
We also had a look at how error handling could work there,

100
00:04:52,290 --> 00:04:54,140
but also as mentioned before,

101
00:04:54,140 --> 00:04:56,350
we are going to see async code

102
00:04:56,350 --> 00:05:00,100
and promises in action again later in the course,

103
00:05:00,100 --> 00:05:02,883
also once we start working with databases.

104
00:05:03,750 --> 00:05:06,850
And, therefore, we had plenty of new content here,

105
00:05:06,850 --> 00:05:11,500
definitely also check out the written guide and cheat sheet,

106
00:05:11,500 --> 00:05:13,840
which you'll find attached to the last lecture

107
00:05:13,840 --> 00:05:15,910
of this course section.

108
00:05:15,910 --> 00:05:18,660
But definitely also don't feel overwhelmed,

109
00:05:18,660 --> 00:05:21,010
instead we're going to see all these concepts

110
00:05:21,010 --> 00:05:23,603
in action again later in the course.

