What is Lexical Scope and Lexical Environment?

·

1 min read

A lexical scope defines the accessibility(visibility) of a variable in child scope which is defined in the parent scope . E.g A variable defined in a parent function is accessible in a nested function(child function)

Lexical Environment defines the relation of variable in child scope to the parent scope.