Command Palette

Search for a command to run...

Hectal
Phase 0: Start Here: Why TypeScript
TypeScript · Exercise 1 of 5Next
Beginner

Fix the Value, Not the Type

The variable age promises to hold a number, but it was given text. The Types panel shows the error, and the console shows the bug it causes: "12" + 1 is "121".

Fix the value so the code type-checks and prints 13. Keep : number.

What Check tests

  1. Your code has no type errors
  2. The console prints 13
  3. age still promises a number

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Console

Nothing printed yet.