// i declared in (), not in {}
for(let i = 0; i < 5; i++){
console.log("for:" + i);
}
console.log(i); // error
Why did it assume that variable i
belongs to loop scope if it was declared outside the loop's body brackets?
I found this:
"Variables declared with let are local to the statement"
Ok, but why is it so?