Var And Let Keyword Difference.

Var and let is same in javascript file var used while intypescript let used to declared the variable.

Let key word is also added to javascript. Javascript haveversion ES5 means ecma script 5 which is supported by pretty much browser.

ES6 – introduced in 2015 from this onwords ecamascript teamis used year number rather than version number then we have

ES2016, ES2017

When you declared variable in javascript it is available toits nearest function. Mean even if you declared var in for loop its alsoaccessible outside of that for block.

But when you used let in for block and you going to access outside that block it gives error outside of that block.

Var And Let Keyword Difference.

If your file at the time of compiling got an error then alsoyour typescript compiler generate the main.js file. By default typescriptcompiler generate the .js file supported by browser which is ES2015.

At the typical space of let keyword compiler removes that let with var keyword.

Below is the Hello World Video.

In below video explain var and Let difference.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *