0
0
Typescriptprogramming~15 mins

What is TypeScript - Hands-On Activity

Choose your learning style9 modes available
What is TypeScript
📖 Scenario: Imagine you want to build a website that is easy to maintain and less prone to errors. TypeScript helps by adding extra checks to your JavaScript code before it runs.
🎯 Goal: Learn the basics of TypeScript by creating a simple variable with a type and printing it.
📋 What You'll Learn
Create a variable with a specific type
Assign a value to the variable
Print the variable value
💡 Why This Matters
🌍 Real World
TypeScript is used to build large websites and apps that are easier to maintain and less error-prone.
💼 Career
Many companies use TypeScript to improve code quality and developer productivity.
Progress0 / 4 steps
1
Create a typed variable
Create a variable called message of type string and set it to 'Hello, TypeScript!'.
Typescript
Need a hint?

Use let to declare a variable and add : string after the variable name to specify its type.

2
Add a number variable
Create a variable called year of type number and set it to 2024.
Typescript
Need a hint?

Use let year: number = 2024; to create a number variable.

3
Combine variables in a message
Create a variable called fullMessage of type string that uses a template string to combine message and year like this: 'Hello, TypeScript! The year is 2024.'.
Typescript
Need a hint?

Use backticks ` and ${} to insert variables inside a string.

4
Print the combined message
Use console.log to print the variable fullMessage.
Typescript
Need a hint?

Use console.log(fullMessage); to show the message in the console.