typescript · level 1 · unit 1 · lesson 4
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
An is a clue, not a disaster.
An error is a message saying something went wrong. Everyone gets them, even experts. Before your code runs, a reads every line. If it spots a mistake, nothing runs until you fix it.
Each error has a code, a message and a line number, like TS1002: Unterminated string literal. (line 1). Unterminated means not finished: a quote mark is missing its partner.
TypeScript is , so Console with a capital C is a stranger. You would see TS2552: Cannot find name 'Console'. The message even suggests the right word.
The code at the start, like TS1002, names the kind of mistake, so you will soon recognise old friends.
guess first
One capital letter. What happens?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
Console.log("Hello!");
your turn
Your turn. Close everything you open.
Type your superpower in place of the blank. Then finish the line so the quote and the bracket are both closed, end it with a semicolon, and press run.
fix it
Breakfast is broken. Can you fix it?
- Read the error. Which line does it point to?
- TypeScript is confused on line 2. Count the quote marks on that line.
- A string needs a quote at both ends. Add " before Come, then press run.
nailed it
you turned errors into clues. :D
- Errors are clues. Read the code, message and line.
- The checker finds many mistakes before anything runs.
- TypeScript is case-sensitive:
consoleworks,Consoledoes not.
new words in your collection
- error
- checker
- case-sensitive
This lesson isn’t saved. A free account remembers every lesson you finish.