0Pricing
TypeScript Academy · Lesson

Arrays and Tuples

Work with arrays and tuples in TypeScript.

1

Arrays and Tuples

Welcome to the next lesson! In this lesson, we’ll explore how to work with arrays and tuples in TypeScript. These structures allow you to store multiple values in an organized way. Let’s dive in!

Arrays and Tuples — illustration 1

2

What Are Arrays?

An array is a collection of items stored in a single variable. In TypeScript, you can specify the type of elements in an array. Example:

Task: Create an array of your favorite numbers and log it to the console.

let numbers: number[] = [1, 2, 3, 4, 5];
let names: string[] = ["Alice", "Bob", "Charlie"];
console.log(numbers);
console.log(names);

All lessons in this course

  1. Arrays and Tuples
  2. Union and Intersection Types
  3. Enums
  4. Literal Types
← Back to TypeScript Academy