For the same reason that any strict operator appears in any programming language - to limit the number of ways you can shoot yourself in the foot. The old school Javascript is just crowded with these.
Note that you can use let for the local-local area:
while (i < 5) { let a = 42; i++; }
Even if the loop is executed several times, a always initialized correctly.
Now, what happens if you have another variable in a higher scope?
let a = 42; while (i < 5) { let a = 10;
There is a certain degree of ambiguity - and ambiguity is a bad feature in a programming language. This is not a problem with non-block var - it has tons of its own problems and people abuse it all the time, but at least it is obvious that var never blocked. And even then - people really use it as if it were blocky.
The only way to fix this madness is to make the language a little more rigorous. Does this actually mean that you have lost any feature? No. Variable shading was a bad idea with var , and it would still be a bad idea with let (and, as my example shows, maybe worse).
This is not unique to Javascript, not a long shot. For example, in C #:
int i = 0; int i = 42; // Compiler error: A local variable named 'i' is already defined in this scope
Why? Because you obviously made a mistake. Perhaps you copied a piece of code from another place and did not notice that you already have another variable named i . You may have forgotten that you are in the middle of another loop that also uses i as a loop variable. There is no real legal use, and yet there are tons of failures - this is just a terrible feature of the language. A simple compiler error prevents almost all of these crashes - and many of these crashes can be very difficult to find, especially if the "inner" block is not used too often.
source share