Posts

Showing posts from June, 2021

The Difference between var and let in typescript

 The Difference between var and let in typescript var :- The  var  statement is used to declare a variable in JavaScript and TypeScript. A variable declared with the  var keyword  is defined throughout the program. That is var has global scope or function scope, the var variable can be declared after the variable is actually used. This characteristic is called Hoisting , and it can be understood through an example. Example      x  =  "Hii Bobby" ;      console . log ( x );      var   x  =  "Hello..." ;      console . log ( x ); Output:- E:\Visual code\typescript>tsc demo.ts E:\Visual code\typescript>node demo Hii Bobby Hello...       var also support re-declaring of the variable, for example: Example      var   x  =  10 ;      if ( x == 10 )      {           ...