Hi Friends 👋,
Welcome to Infinitbility ❤️!
This tutorial is part of the below series.
TypeScript define variable
Let start Part 1: How to define type in typescript?
When we start writing code in typescript, so we have to define also type of every variable to hold any value.
like when storing any integer in a variable.
let num: number = 123;
Now, here we have created the
num variable with the
number data type.
same from string and other data types also…
let str: string = "shani"; let bool: boolean = true;
Let’s write some variables and check their data type.
let num: number = 123; let str: string = "123"; let bool: boolean = true; typeof num; typeof str; typeof bool;