Javascript Arrays

Javascript arrays are one of the two most useful container types you can use in Javascript. This is how you declare one:

var PERSONlist = =["Fred", "Mary", "Jane"];

To access it’s members we reference by the index. The index starts from 0:

console.log(PERSONlist[0]); // log the first member of this array

The number of items in an array is given by the “length” property:

var PERSONcount = PERSONlist.length; // PERSONcount will contain 3 in this case.