scopes matter with closures

JSvaluefunctionclosure ⟩ scopes matter

it matters from which scope your closure closes over variables.

the scoping effect of the initialization block can be understood as if the declaration happens within the loop body, but just happens to be accessible within the condition and update parts.

📘 MDN

Last updated