---
title: "JavaScript: Arrays"
date: 2013-02-02
description: "Arrays are variables that have multiple values. You normally write out variables like this: {% highlight javascript %}var game = 49;{% endhighlight %} However, an array stores multiple values for..."
canonical_url: https://idratherbewriting.com/arrays-javascript/
---
# JavaScript: Arrays
Arrays are variables that have multiple values. You normally write out variables like this:

However, an array stores multiple values for the same variable. It sets each value at different index positions. A sample array might be as follows:

The positions for each index in the array are listed in brackets after the variable. Arrays always start at an index of 0 (not 1) and increment upward.

Listing out each position in the array on its own line is lengthy, so there's a shorter way to list the positions in the array:

The order of the values reflects their positions. `49` corresponds to position 0, `56` corresponds to position 1, `63` corresponds to position 2, and so on.

If you want to get the value from an array, add the position you want in brackets after the array's name:

This would return the value `Touchdown!`.