function A() {
let local = "local";
for (let i = 0; i < 4; i++) {
var var_variable = "var_variable";
const k = 10;
{
var block = "block";
}
function inside() {
console.log("yo");
}
inside();
}
}
A();
I know let
and const
are block scoped.
If you see from the image, let variable i
has an own block and the for
loop block which contain const
scoped to that block and var
which is scoped to that execution context.
My question is does let get copied into the for loop block in each iteration and destroyed?