Smal SEO Tool

JavaScript Arrays

An array is a special variable, which can hold more than one value.

Creating an Array

Using an array literal is the easiest way to create a JavaScript Array:

javascript
const cars = ["Saab", "Volvo", "BMW"];

Accessing Array Elements

You access an array element by referring to the index number:

javascript
let car = cars[0]; // car will be "Saab"

Test Yourself with an Exercise

How do you create an array in JavaScript?