Key Concepts

Review core concepts you need to learn to master this subject

TypeScript Type for One-dimensional Array

// zipcodes is an array of strings let zipcodes: string[] = ['03255', '02134', '08002', '03063']; // Pushing a number to zipcodes will generate an error // Error: Argument of type 'number' is not assignable to parameter of type 'string'. zipcodes.push(90210);

The type annotation for a one-dimensional array in TypeScript is similar to a primitive data type, except we add a [] after the type.

Arrays
Lesson 1 of 2

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo