Fill: Union Type
Fill in the Blank Easy
Question
Fill in the blank to make id accept either a string or a number:
Code
let id: string ___ number;
Hint
The pipe symbol creates union types.
Explanation
The pipe | creates a union type. The full annotation is let id: string | number;. This means id can hold either a string or a number value.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.