Wednesday, June 30, 2021
TypeScript - Variable With Example Demo ( var, let ,const)
TypeScript follows the same rules as JavaScript for variable declarations. Variables can be declared using: var, let, and const.
var
Variables in TypeScript can be declared using var keyword, same as in JavaScript. The scoping rules remains the same as in JavaScript.
let
To solve problems with var declarations, ES6 introduced two new types of variable declarations in JavaScript, using the keywords let and const. TypeScript, being a superset of JavaScript, also supports these new types of variable declarations.
Const
Variables can be declared using const similar to var or let declarations. The const makes a variable a constant where its value cannot be changed. Const variables have the same scoping rules as let variables.
Demo:
Demo:
Subscribe to:
Post Comments (Atom)
How to build an Express and Node.js app with Typescript
In this tutorial, you will learn how to set up a Node.js and Express project with Typescript and live auto-reloading. Note that this metho...
-
Below is a simple form with two fields and a button. We will use this setup to illustrate the different ways to disable form controls. He...
-
ngx-image-compress demo Upload and compress Image Upload Image only Click For Demo
-
TypeScript is an open-source object-oriented language developed and maintained by Microsoft, licensed under Apache 2 license. It is a typed ...
No comments:
Post a Comment