0

What is an array ?

7th Sep 2022, 2:36 AM
Alok Kumar Maurya
Alok Kumar Maurya - avatar
2 Answers
+ 2
Its like a Variable that stores multiples values For example The variable var name = "Alok"; Stores the value "Alok" But if you are (for example) a teacher and want to type every name into a variable, you would have to create a lot of variables But if you use an Array, you just need to declare one variable For example (With variables) var name1 = "Alok"; var name2 = "Kenan"; var name3 = "Robert"; var name4 = "Tim"; ... (With an Array) var names = ["Alok", "Kenan", "Robert", "Tim" ... ]; You just declared one variable, with multiple values Also u need to use these brackets [ ] and seperate each value with an comma ,
7th Sep 2022, 11:03 PM
Kenan
Kenan - avatar
+ 1
A list of items you can access by index value. 0 to n-1. The course covers them well if you take your time reading through it.
7th Sep 2022, 3:05 AM
morl
morl - avatar