TypeScript · Exercise 1 of 6Next
Beginner
Annotate a Whole Function
Strict mode reports the parameters of perimeter because nobody typed them. Add a type to both parameters and a return type to the function.
The checks call perimeter("3", 4) and expect TypeScript to reject it.
What Check tests
- Your code has no type errors
- The console prints
14 - A text argument is rejected
- The return type is written down
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.
Press Run to see the page.
Console
Nothing printed yet.