Execution context in javascript
When a file is executed in javascript there are two phases of execution. One is the memory creation phase (phase one), another one is code execution phase (phase two). In the memory creation phase javascript engine skims through the program and allocates undefined to variables and assigns function definition as it is to its name.
• 3 min read