TypeScript tutorialLesson 7Free preview
TS Arrays
This lesson is part of TypeScript · All levels
Summary
The TypeScript array stores a set of values of the same type and is declared with a type pattern[]. Since the type is locked, adding different values will trigger compilation error. Readonly and union variants are also available for cases requiring flexibility.
Key points
- Syntax array: number[] or Array
- The array content must be according to the declaration type
- The map/filter method produces a new array
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.