JavaScript arrays are used to store multiple values in a single variable. An array can hold many values under a single name, and you can access its values by referring to an index number.
Imagine you have a list of items (ie. cities).
Storing these items in single variables could look like this:
var city1 = "NYC";
var city2 = "Chicago";
var city3 = "Miami";
... and on.
Now let's say this list has 300 different city names, therefore 300 different, single variables exist.
What if we wanted to loop through this list and find a specific one?
Or apply a common value to only certain variables?
The solution is an array!
Find out how to create an array works in javascript by returning to the HOME page.