Now that length property is also interesting
because it does not just exist on strings,
but also on arrays.
Let's say we have an array,
either created just in time like this, when we need it
or stored in a variable like hobbies.
And then here I'll have sports and cooking.
And if I now use this array and I add a dot on this,
then I also get a bunch of methods
and properties there as well,
including this length property.
And this length property then will tell us
how many items are in this array.
So in this case for hobbies, we have two elements in there.
And hence, if I save this, I get two as a result,
since I have two items in that array.
And of course,
there's kind of a relation between length on a string
and length on an array.
You could say that a string is a bit like an array.
It's technically not exactly the same,
but a string of course,
is a collection of characters,
an array is a collection of any kind of values.
That's why we have length on both.
Now on our array, if I, again, add a dot after hobbies,
we also have many methods here,
like push or reduce or sort,
but these are a bit more advanced and therefore,
we will not explore them right now.
I just wanted to highlight this length property
since it is very useful,
we will need it later in the course,
and in many programs you are going to write,
you probably will also have some scenarios where you want to
count characters or elements in an array,
and that's why length can be useful.
And that's it for these operations and values
and what you can do with them for the moment.
You will see a lot of these operations and a lot of these
properties and so on being used throughout this course.
And that's why I wanted to give you a summary and an
overview of these important operations here.