What is and how to use Javascript Arrays!

What is and how to use Javascript Arrays!

I will try to break down the concept of Arrays to an easy to understand level!

What is an Array? An Array is a different kind of variable that can hold more than one value at a time. The length of the array is not fixed. You can have a couple items in there or AS MANY AS YOUR HEART DESIRES! Unlike a string, an array can store data of ANY TYPE. Very useful!

So how do we declare an array? First we declare our array the same way we would with a normal variable.

let exampleArray =

Now unlike a string we will use [ ] instead of " " The program understands that this is a list of values because of [ ] Separate each value with a comma ,

Blue, Violet and Orange Shapes Fitness Influencer YouTube Thumbnail Set (5).png

let namesOfPhoneBrands = [ "Samsung", "Google", "Apple"]

In our array we have 3 strings. Each String is Separated with a ,

Now if I want to know what is the very first value in an array, I can search the 0 position. To do this I will use


which is Samsung.

This method of finding out the value in the first position is called Bracket Notation. Which is a fancy way of saying, using the square brackets. lol The value inside of the Brackets is called the index. The index of an array is the numbered order given to the item. If I have an array and want to know how many values are in that array, I can use the length property to find out! VERY useful.


which will give us 3 as there are 3 values.

Arrays are mutable. What's that even mean?

Mutable basically means, can it be edited. For example, Strings are immutable. Can't edit. Changes to a string result in a new string. HOWEVER, Arrays ARE MUTABLE. Meaning they can be edited without creating a new array. Very IMPORTANT! Now the VERY cool thing with Arrays are the Array Methods! I will do a separate post explaining every method. A Method is something that can alter, adjust, create or return info from the array.


Removes & returns the LAST ELEMENT in an array. pop() is a method.

You went through the basics of an Array, You used Bracket Notation to find the index position of a value, you found the total length of the array and also understand that the Array IS MUTABLE and used an Array method!

You are incredible!

I Hope this helped! Please let me know if you need some further explanations. I will probably make a video on this where I can go more in depth about the concepts.

If you want to catch that video subscribe to my youtube channel Youtube Channel

If you liked my blog post you will love my social media posts! Check out my twitter page Twitter