๐ Day 2๏ธโฃ6๏ธโฃ / 3๏ธโฃ0๏ธโฃ days of basics in JavaScript series!
โ What is an array?
โ How many types of creating an array?
โ How to access array items & full array?
โ How to change the array items?
โ The data type of the array?
#javascript30
๐งตโฉ
๐ What is an array?
โ It is a special variable that can be store more than one value.
โ If you have multiple data items then you can use an array for storing those items.
โ It can hold many values in a single variable.
โ Or, storing a collection of multiple items in a single variable.
โ Js array can contain mixed types of data or items, like string, decimal, float, boolean, etc.
๐ How many types of creating an array?
โ There are 2 ways for creating an array for now.
1๏ธโฃ Using array literals
2๏ธโฃ Using new keyword
1๏ธโฃ Using array literals [ ]
โ That means we can create an array using square brackets separated by semicolons.
โ Space and lines are not important, they can be spanned in multiple lines.
โ Generally, many people use this method for creating arrays.
2๏ธโฃ Using new keyword
โ We can also use the new keyword for creating the array.
๐ How to access array items & full array?
๐ Access array items: We can access the items of an array using the index.
- 1st item = 0 index
- 2nd item = 1 index
- 3rd item = 2 index
- 4th item = 3 index
and so on...
โ Arrays index starts from 0.
๐ Access full array: We can access the full array using the name of the array.
๐ How to change the array items?
โ We can change the items of the array using the index number.
๐ The data type of the array?
โ It is a non-primitive data type.
โ An object is the data type of the array.
๐ That's all for now, we will meet in the next thread!
But if you like make sure to:
1. Follow me @ATechAjay
2. Retweet the first tweet.
3. Turn on the notification to never miss these amazing tweets.
Thank you so much for staying to the end of this thread.
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.