Click the link below to open an exercise where we will explore this question.
date to be output … but is this the case?
- Check the editors console and find out.
boolean types, but there is no specific
date type - instead, dates are of type
- Let's experiment with some other variables. Copy, paste, and run the following code in the code editor above:
const count = BigInt(452947234234);console.log("count", typeof count);const address = null;console.log("address", typeof address);const phone = undefined;console.log("phone", typeof phone);const stars = Symbol("***");console.log("stars", typeof stars);
Notice that the type of a
null variable is
object and not
Examine the code below.
let amount = 10;console.log("amount", typeof amount);amount = "Eight";console.log("amount", typeof amount);
amount variable starts as a number but then is assigned to a string. So, we'd hope to get an error or maybe a warning, but do we? Copy, paste, and run the code into the code editor at the top of this page to find out.
The lack of a rich type system with a type-checking process is what TypeScript brings to the table. We’ll learn how to use this type system in this course to make us more productive when developing apps.
In the next lesson, we will learn how to declare variables with types in TypeScript.