Skip to main content

Command Palette

Search for a command to run...

The Array

The Numbered Shelf

Updated
1 min read
The Array

An array is a numbered shelf for your data. Each item gets its own fixed slot, accessible instantly by its index number. This makes lookups incredibly fast. But the shelf has a fixed size; once it's full, you can't easily add more space. It’s a disciplined, efficient organizer.

// A shelf with three fixed slots
const numberedShelf: string[] = ["Book", "Photo Frame", "Clock"];

// Instantly access the item at slot 0 (0-indexed)
const item = numberedShelf[0]; // "Book"

// Instantly access the item at slot 1 (0-indexed)
const item = numberedShelf[1]; // "Photo Frame"

// Instantly access the item at slot 2 (0-indexed)
const item = numberedShelf[2]; // "Clock"

🇨🇴 Versión en Español

Data Structures

Part 1 of 1

Data structures are a crew of expert workers. Each excels at one task—like fast access or flexible storage—but fails at others. **Choosing the right worker for the job is the secret to high-performance software.** This series introduces the team.