Grasping TypeScript Types

Hello, Space Explorer! Today, we're going to delve into the TypeScript data types. Think of data types as different celestial objects in our universe, each with its unique properties and uses. We'll explore five core TypeScript types — Number, String, Boolean, Void, and Undefined.

In TypeScript, types are categorized based on their characteristics. Understanding this is akin to realizing that Earth is a planet, not a star or an asteroid. This knowledge helps us predict behaviors in different situations.

Unveiling the Numerical Type

First, we're going to uncover numerical values through the Number type, which stores numbers such as 10 (integer numbers) or -2.19 (floating point numbers, i.e., numbers with a decimal point). Let's visualize it:

Upon running this code, you'll see 8 and printed — these are the values of our declared and variables.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal