block-scoped variable

noun
UK /blɒk skəʊpt ˈveəriəbl/
US /blɑːk skoʊpt ˈveriəbl/

A variable that only works inside the little section of code where it was made.

The loop counter is a block-scoped variable, so it disappears once the loop finishes.


OTHER MEANINGS

2. A variable declared with let or const that cannot be seen outside its enclosing braces.

Because it is a block-scoped variable, calling it after the if-block throws a ReferenceError.

3. A name whose visibility is limited to the nearest pair of curly braces in a program.

Inside the function, the block-scoped variable shadows the outer one with the same name.

4. A binding that is created fresh each time its block runs, rather than once for the whole function.

Each iteration of the for loop gets its own block-scoped variable, which is why the callbacks log different numbers.