Important Quote I Heard on the Internet :
What is Execution Context?
We can Call Execution Context as simple as a Box, where it stores the code and executes it.
The image shows What the Execution Context looks like.
The New Local Execution context is create for every single function and it get executed when it call and stored the output in varible or we can display it .
What is Execution stack / Call Stack ?
Call Stack Maintain the Order of Execution of Execution Context
The Execution context is work in Stack so , the Stack we used called as Execution stack / Call Stack .Below is image of above code how the code is Executed in call stack.
The Above Explaination can Answerd the Below Question ?
- This allows you to use variables and functions before they are declared in the code.
- However, only the declarations are hoisted, not the initializations.
- This enables you to call a function before its actual declaration in the code.
However, this behavior does not apply to function expressions or arrow functions assigned to variables. (Important)
- Helps explain unexpected behavior when functions or variables seem to be accessible before their declaration.
- Facilitates identifying and resolving issues related to variable and function scope.
- Aids in understanding the flow of code execution during debugging sessions.
4.What is the difference between function declarations and function expressions regarding hoisting?
|Aspect||Function Declarations||Function Expressions|
|Hoisting Behavior||Entire declaration is hoisted to the top.||Only variable declaration is hoisted, not the function.|
|Can be called before declaration in the code.||Yes||No|
List of Some important Leet code Questions:
- Leet code 799. Champagne Tower
- LeetCode 389. Find The Difference
- Leetcode 775. Find The Global and Local Inversions
- Leetcode 316. Remove Duplicate Letters
- LeetCode 2233 Maximum Product After K Increments
- LeetCode 880. Decoded String at Index
- LeetCode 905. Sort Array By Parity
- LeetCode 896. Monotonic Array
- LeetCode 132. Pattern
- LeetCode 557. Reverse Words in a String III (easy)
- Leetcode 2038. Remove Colored Pieces if Both Neighbors are the Same Color
- Leetcode 1512. Number of Good Pairs (easy)
- Leetcode 706. Design HashMap (Easy)
- LeetCode 229. Majority Element II (Medium)