π¨βπΌ Great work with arrays! You now know how to:
- π Create typed arrays with
Array<Type>(preferred) orType[] - β Get type safety when adding elements
- π Iterate over arrays with
for...of - π Use union types for mixed arrays
π¦ Array types shine when combined with object types:
const users: Array<{ name: string; age: number }> = [
{ name: 'Alice', age: 30 },
{ name: 'Bob', age: 25 },
]
Next up: Tuplesβarrays with fixed length and specific types at each position!