55 Array dynamic in JS - Javascript Tutorial 2018

Опубликовано: 30 Август 2017
на канале: Ricky Wahowa
139
2

The Full #Javascript #tutorial for #beginners :
http://bizanosa.com/js

Wath full HTML,CSS and Javascript tutorial here : http://bizanosa.com/sp/learn-html-css...

Javascript Tutorial 2018


55 Array dynamic in JS - JavaScript for Beginners.

This is a Javascript tutorial from scratch for any beginner. Use the above link to watch the full JS video tutorial..

Next Video:    • 56 Array literal -  Javascript Tutorial 2018  
Previous Video:    • 54 Create Arrays in Javascript - JS Tutori...  

Hi, and welcome back.

So this is where we ended the last video.

And before I go on, I want you to know that we are currently looking at array literals.

But later on, we are going to look at arrays in detail.

Now, you can see here we have three elements.

Now the thing about JavaScript is that you don't have to declare the size of the array.

The size of the array can grow dynamically.

So if I come here and I say, let’s access element 4.

And we don't have element 4, right.

We only go up to 0, 1, 2.

So if I tried to show the value of this, display that, you’ll see that it tells us that element 4 is undefined and JavaScript has created that element for us.

So now, if you come here and let’s continue looking at people and we try to display the elements which are there, you’ll see that it gives us three elements.

But if I give this a value, let me remove these bits, I don't need up to that bit.

If I come here and I give this array a value, let's say, let’s give it 12, right.

And then, now let’s see what elements we have inside of this array.

If I display, you’ll see that it gives us 1, 2, 3 and then an empty array in there, an empty element in there and then 12.

So the thing about JavaScript and we’re going to look at this later on once we get into array literals as well.

The thing about JavaScript, array elements will grow dynamically.

So if you add something, if you add something, that will increase the size of the array.

Like you can see here, we created this array[4] and we gave it a value.

And after doing that, JavaScript assumed that the third element will also be there.

But let’s just make it undefined.

It is empty.

And let’s add the fourth element.

You know array is a contiguous element meaning that they border each other.

You can skip one array.

So even though there is nothing to put here, this array space was just created and you can add something later on.

So that’s why JavaScript knows that arrays are contiguous elements and therefore it did not keep this.

It created it as an empty element with undefined.

There is nothing in there and then it went to the fourth one and added our element.

So that’s what it assumed.

So I hope you’re understanding what I mean by this.

And I just wanted to show you that bit where arrays in JavaScript are dynamic unlike in other programming languages whereby once you set the size of the array, the size of the array will remain static like you directed it when you’re creating that particular array.

So that’s what I wanted to look at in this video.

And in the next video, let’s continue on looking at array literals.

So I’ll see you in the next video.


GET SOCIAL WITH ME:
FACEBOOK:   / rwahowa  
INSTAGRAM:   / rwahowa  
TWITTER:   / rwahowa  
VIMEO: https://vimeo.com/bizanosa/
WEBSITE : http://rwahowa.com


На этой странице сайта вы можете посмотреть видео онлайн 55 Array dynamic in JS - Javascript Tutorial 2018 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Ricky Wahowa 30 Август 2017, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 139 раз и оно понравилось 2 зрителям. Приятного просмотра!