Medium

Question 1/42

0

/42

Closure and Scope

What will be logged when this code runs? function outer() { let x = 10; return function inner() { console.log(x); }; } const fn = outer(); fn();

Why This Answer?

Closure and Scope

# Closure and Scope The inner function forms a closure over the variable `x` from the outer function's scope, maintaining access to it even after outer() has returned. \`\`\`