This repository provides a deep dive into how JavaScript works under the hood. It includes detailed diagrams (created using tldraw) and code examples.
-
High level overview of JavaScript
- High level
- Garbage collected
- Interpreted just in time
- multi paradigm
- Prototype based object oriented
- First class function
- Dynamic in nature
- Single threaded
- non blocking event loop
-
- Heap ( object memory storage )
- callstack
- execution context.
-
- js engine
- web apis
- callback queue
- microTask queue
- macroTask queue
- event loop
-
Compilation and Interpreter Working Process
- compilation vs interpretation
- jit (just in time process);
1.src -> parsing -> ast -> compilation -> execution ( * again recompile go to compilation ); -
- Global Execution Context
- Variable Environment
- Scope Chain
- This Keyword
- Execution Context
- Global Execution Context
-
Deep dive inside Execution Context
-
Variable Environment
-
-
Type Scope
- Global Scope
- Function Scope
- Block Scope
Only variable lookup scope chain is allowed
-
-
thisin normal function callingthisin methods callingthisin arrow functionthisin event listener
thisnever points to itself or the variable environmentcall()apply()bind()
-
Arguments keywords in Execution Context
-
Memory Management Life Cycle
- Memory Allocation
- Call Stack
- Heap Memory
- Memory Allocation
-
Shallow copy and Deep copy
-
Garbage Collection
- Mark and Sweep algorithms
-