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
-
Explain the concept of closures in JavaScript
JavaScript Mid-level -
What is hoisting and what do you know about it?
JavaScript Mid-level -
What does prototypal inheritance mean?
JavaScript Mid-level