I have read Variables and scoping in ECMAScript 6, but I still got some strange output when I execute the codes in browser console below
for(let i = 0; i < 0;) {
var i
}//Uncaught SyntaxError: Identifier 'i' has already been declared
for(let i = 0; i < 0;) {
let i
}//undefined
Why the first one throws an error? When I try this in parameter, it goes opposite
function foo(x){
let x
}//Uncaught SyntaxError: Identifier 'x' has already been declared
function foo(x){
var x
}//undefined