I know that when I declare a let variable in a loop the variable is declared in each cycle. For instance:
for(let i=0 ; i<3 ; i++)
{
let x=1;
}
The variable x
is declared 3 times namely are allocated three different places in the memory for each variable in the loop.
However what does it happen to the variable i
? Is it declared once?
Or is it initialized one time alone but is declared three times too?
I would like to understand what it happens behind the scene.