1
00:00:02,090 --> 00:00:06,270
Now that length property is also interesting

2
00:00:06,270 --> 00:00:08,899
because it does not just exist on strings,

3
00:00:08,899 --> 00:00:11,323
but also on arrays.

4
00:00:12,190 --> 00:00:14,060
Let's say we have an array,

5
00:00:14,060 --> 00:00:18,180
either created just in time like this, when we need it

6
00:00:18,180 --> 00:00:21,920
or stored in a variable like hobbies.

7
00:00:21,920 --> 00:00:25,363
And then here I'll have sports and cooking.

8
00:00:27,040 --> 00:00:31,570
And if I now use this array and I add a dot on this,

9
00:00:31,570 --> 00:00:34,580
then I also get a bunch of methods

10
00:00:34,580 --> 00:00:37,220
and properties there as well,

11
00:00:37,220 --> 00:00:39,893
including this length property.

12
00:00:40,880 --> 00:00:43,660
And this length property then will tell us

13
00:00:43,660 --> 00:00:46,476
how many items are in this array.

14
00:00:46,476 --> 00:00:50,770
So in this case for hobbies, we have two elements in there.

15
00:00:50,770 --> 00:00:54,660
And hence, if I save this, I get two as a result,

16
00:00:54,660 --> 00:00:56,903
since I have two items in that array.

17
00:00:57,880 --> 00:00:58,713
And of course,

18
00:00:58,713 --> 00:01:02,080
there's kind of a relation between length on a string

19
00:01:02,080 --> 00:01:03,820
and length on an array.

20
00:01:03,820 --> 00:01:07,310
You could say that a string is a bit like an array.

21
00:01:07,310 --> 00:01:09,740
It's technically not exactly the same,

22
00:01:09,740 --> 00:01:10,910
but a string of course,

23
00:01:10,910 --> 00:01:12,890
is a collection of characters,

24
00:01:12,890 --> 00:01:16,220
an array is a collection of any kind of values.

25
00:01:16,220 --> 00:01:18,463
That's why we have length on both.

26
00:01:20,010 --> 00:01:24,700
Now on our array, if I, again, add a dot after hobbies,

27
00:01:24,700 --> 00:01:27,250
we also have many methods here,

28
00:01:27,250 --> 00:01:30,750
like push or reduce or sort,

29
00:01:30,750 --> 00:01:33,690
but these are a bit more advanced and therefore,

30
00:01:33,690 --> 00:01:36,060
we will not explore them right now.

31
00:01:36,060 --> 00:01:39,560
I just wanted to highlight this length property

32
00:01:39,560 --> 00:01:41,210
since it is very useful,

33
00:01:41,210 --> 00:01:43,250
we will need it later in the course,

34
00:01:43,250 --> 00:01:45,717
and in many programs you are going to write,

35
00:01:45,717 --> 00:01:49,800
you probably will also have some scenarios where you want to

36
00:01:49,800 --> 00:01:52,610
count characters or elements in an array,

37
00:01:52,610 --> 00:01:54,943
and that's why length can be useful.

38
00:01:55,860 --> 00:01:59,380
And that's it for these operations and values

39
00:01:59,380 --> 00:02:02,250
and what you can do with them for the moment.

40
00:02:02,250 --> 00:02:06,091
You will see a lot of these operations and a lot of these

41
00:02:06,091 --> 00:02:09,949
properties and so on being used throughout this course.

42
00:02:09,949 --> 00:02:12,980
And that's why I wanted to give you a summary and an

43
00:02:12,980 --> 00:02:15,963
overview of these important operations here.

