/
Javascript Arrays

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.

Related content

Javascript Variables - Covering the core types
Javascript Variables - Covering the core types
More like this
Javascript Containers
Javascript Containers
More like this
Javascript Object
Javascript Object
More like this
Javascript Strings
Javascript Strings
More like this
Javascript Functions
Javascript Functions
More like this
DOM Element
DOM Element
Read with this