0Pricing
TypeScript Academy · Lesson

Arrays & ReadonlyArray

Learn array basics, the difference between mutable arrays and ReadonlyArray, and how to use typed methods safely.

Intro

Goal: Understand how to declare arrays, use methods with types, and know when to use ReadonlyArray for immutability.

Array declaration

Arrays can be typed with element type syntax (e.g., number[]).

const numbers: number[] = [1, 2, 3];
console.log(numbers[0]);

All lessons in this course

  1. Arrays & ReadonlyArray
  2. Tuples & labeled tuples
  3. Enums vs const enum vs union-literal alternatives
← Back to TypeScript Academy