Closures

4/5

Access variables defined in the current function's scope and the scope of any parent function or the global scope.


What is printed to the console?

let i = 0; for (i = 0; i < 3; i++) { setTimeout(() => { i++; console.log(i); }, 0); }

Choose one