Explain lexical scope in JavaScript

Experience Level: Mid-level
Tags: JavaScript

Answer

Lexical Scoping defines how variable names are resolved in nested functions: inner functions contain the scope of parent functions even if the parent function has returned.

Related JavaScript job interview questions