Refer to this to know what TS is able to compile: https://kangax.github.io/compat-table/es6/
const can’t be changed.
But why did they bring new “let” instead of sticking with the old “var”?
This is because of scope:
With var we have a global and a function scope. So, variables defined outside the functions are available everywhere in the script and variables defined inside the functions only available inside that function:

This is fine, but what about the if statements:

Here, this will give error in TS but not in JS. So, if I compile and check browser:

You can see it is working fine. “let” fixes this. So, similarly if I do this using let:


Here, you can see we got the error in the browser instead of the output.
This will give error in both TS and JS and it won’t work. So, it is a good practice to use let instead of var.
Now, let is doing this because it uses something called as a block scope which means it has its availability only inside of {}.

Arrow functions save a lot of time and are very useful.