1
00:00:02,280 --> 00:00:03,660
With this example finished,

2
00:00:03,690 --> 00:00:10,530
there are more exciting things we can dive into when it comes to Javascript and object syntax or Javascript

3
00:00:10,530 --> 00:00:18,090
features that help us work with objects. One important thing which I again want to emphasize is the concept

4
00:00:18,120 --> 00:00:19,520
of chaining,

5
00:00:19,590 --> 00:00:22,510
here we're doing something which is called chaining.

6
00:00:22,620 --> 00:00:28,920
We're having multiple dots in one and the same line or to be precise, in one and the same expression because

7
00:00:28,920 --> 00:00:35,550
we just prefer multiple operations on objects or on values returned by prior operations,

8
00:00:35,550 --> 00:00:42,120
for example movie.info returns an object and therefore we can access .title on that object.

9
00:00:42,120 --> 00:00:47,700
We don't have to split this across multiple lines and store the result of movie.info in a variable

10
00:00:47,790 --> 00:00:50,160
and then use .title on that variable,

11
00:00:50,220 --> 00:00:52,260
we can all do it in one line.

12
00:00:52,260 --> 00:00:57,090
This concept of chaining is not only available on properties but also on methods,

13
00:00:57,090 --> 00:01:04,410
for example here with the ID. Math.random uses this built-in math object to generate a random number.

14
00:01:04,410 --> 00:01:11,100
Now it turns out that numbers in Javascript also have a method you can use which is called toString,

15
00:01:11,100 --> 00:01:15,030
actually everything in Javascript has this toString method.

16
00:01:15,030 --> 00:01:21,360
Now what I'm doing here is I'm chaining the toString method on the result of math.random, so random

17
00:01:21,360 --> 00:01:27,160
is called on math and gives me a random number and toString is then called on that number.

18
00:01:27,180 --> 00:01:33,990
So this concept of chaining and this term, this special word, chaining, that is something you should memorize

19
00:01:33,990 --> 00:01:39,870
because you'll see it a lot in most programming languages and especially in Javascript, it is a common

20
00:01:39,870 --> 00:01:40,780
thing to do,

21
00:01:40,800 --> 00:01:48,240
it simply saves you the hassle of splitting code unnecessarily across multiple lines with helper variables

22
00:01:48,300 --> 00:01:48,960
in between.
