let username: string = "JohnDoe";
let age: number = 30;
let isActive: boolean = true;

console.log(`Username: ${username}, Age: ${age}, Active: ${isActive}`);
Bash

Explanation:

  • This program demonstrates how to declare variables with specific types in TypeScript.
  • The username variable is of type string, age is of type number, and isActive is of type boolean.
  • The console.log statement uses template literals to print the values.
Resize text
Scroll to Top