Saturday, April 20, 2024

How to declares variables in TypeScript?

declares variables in TypeScript

Hello, welcome to In this post, I will tell you How to declares variables in TypeScript? I recently started learning Angularjs 2 but I familiar with Angularjs 1 but in Angularjs 2 came with new feature called TypeScript. TypeScript coding structure similar with oops. C# and Java developers can easily learn TypeScript.

Today we will How to declares variables in TypeScript? . here you can check the code:

1. String variables :

var name:string = “therichposrt”;

2. Number variables :

var num:number = 20;

3. Any variables :

var numstr:any = “str20”;

4. Boolean variables :

var isval:boolean = true”;

5. Array variables :

var list:number[] = [1, 2, 3];

var name:string[] = [“rich”, “post”];

There are many more TypeScript and i will let you know all. Please do comment if you any query related to this post. Thank you.

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.