bhylu.com

Advertisements

JS Arrays

An array stores an ordered list. Indexes start at zero, so the first item is at position zero.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

const tools = ["Brush", "Tape", "Ruler"];
console.log(tools[0]);
console.log(tools.length);

What happens

The first item is Brush and the length is 3.