0 of 8 problems solved • 0%
Use in a course

Array Basics

8 exercisesEasy

Arrays keep an ordered collection of related values under one name. Each item has a zero-based index, so the first item is at position 0, and .length reports how many items the array contains.

const destinations = ["Malmö", "Oslo", "Tallinn"]; console.log(destinations[0]); // Malmö console.log(destinations.length); // 3 console.log(destinations.at(-1)); // Tallinn

Start by creating arrays, reading specific positions, and connecting indexes with length. Once those ideas are solid, changing and looping through collections becomes much easier to reason about.