0% Complete
0/0 Steps

Participants 0

JavaScript Arrays

JavaScript arrays are written with square brackets.

Array items are separated by commas.

The following code declares (creates) an array called cars, containing three items (car names):

Example

var cars = ["Saab", "Volvo", "BMW"];

Array indexes are zero-based, which means the first item is [0], second is [1], and so on.

You will learn more about arrays later in this tutorial.

Welcome to the Digital Strategy Hub

We are in beta and please email support @ centerfordigitalstrategy.com with any issues or features that would make your experience better.


We have a feedback call to hear what would be most useful to you:

Thursday April at 1 ET / 10am PT