COURSE · 6 chapters · 30 lessons
TypeScript
Add types to JavaScript and catch mistakes before you run anything
This picks up where the JavaScript course leaves off, so treat it as a stretch unit. Come back once you have finished variables, arrays, functions and classes. It is optional — heading straight to HTML & CSS is perfectly fine. See the JavaScript course
Read about this chapter
Declare what kind of value it is
- 01Your first TypeScriptWrite down what kind of value a variable is allowed to hold, and catch mistakes before you run anything.Go to the exercises
- 02The number and boolean typesTell
numberandbooleanapart, so you never mix up a sum with a yes-or-no.Go to the exercises
Type arrays and functions
- 03Adding types to arraysWrite it like
string[]so that even the contents of a collection are all the same kind.Go to the exercises - 04Adding types to functionsWrite the type of what goes in and what comes out, so a wrong use turns up on the spot.Go to the exercises