Function A
, declared inside another function B
. Function A
has access to variables of function B
even if function B
finished execution already
function createCounter() { let count = 0; function increment() { count++; console.log(count); } return increment; } const counter = createCounter(); // createCounter finished execution counter(); // 1 increment still has access to variable count and it modifies it counter(); // 2 counter(); // 3