Lexical Environment
Lexical means the words or vocabulary in a language. In case of JavaScript, it means the names known to a specific code block.
A lexical environment is a map of all variables and functions known at each level. At the first step, the runtime creates a lexical environment for each scope. It does this for all the code in the execution.
The lexical environment holds all the variables and functions known at that level. It also holds a reference to the parent environment's map.
Functions - Full value of the function is stored.
var - undefined. Value assigned when the assignment code is executed.
let - locked in TDZ. Not accessible at all until value is assigned.
const - locked in TDZ. Not accessible at all until value is assigned.
The values in the map of the lexical environment entries are just memory addresses for the values.

- Global environment - created when the program starts. Eg., when browser starts.
- Function environment - created each time the function is executed.
- Block environment - created each time the control passes through a block.
Hoisting is a side effect of how lexical environments are built and filled during the creation phase.