1. What is the closure?

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
Struggling to find common date to meet with your friends? Try our new tool commondate.xyz
devFlipCards 2025

Do you accept cookies?

Cookies are small amounts of data saved locally on you device, which helps our website - it saves your settings like theme or language. It helps in adjusting ads and in traffic analysis. By using this site, you consent cookies usage.

Struggling to find common date to meet with your friends? Try our new tool
commondate.xyz