Arrays
Put the element type before [] to describe an array. This makes
accidental mixed collections obvious.
TypeScript
const scores: number[] = [12, 19, 25]; const names: Array<string> = ["Ada", "Lin"];
Tuples
A tuple describes a fixed-length collection where each position has a known type. It is ideal for small values such as coordinates.
TypeScript
const location: [number, number] = [55.9533, -3.1883];
Readonly data
Use readonly string[] for an array that a function may inspect
but must not change. This lets a caller pass either a mutable or readonly
array while keeping the function honest about mutation.
Did you know my courses are all printer-friendly? This means you can easily export them to PDF or print them for later use.
