Array

Array is a variable that have a multiple values assign to it. There are some rules for array below:
  1. The first item always has an index of 0.
  2. Naming rule are same as in variable. Only letters, numbers, dollar sign and underscore.
  3. Since there are lots of value, developers prefer to make array name plural like cities, names etc

Code Structure
var cities = ["London", "Reading", "Liverpool", "Manchester", "Basingstoke"];
alert(cities[2]);

Share this

Related Posts