In JavaScript,
The JavaScript Engine is made up of two primary parts:
Memory Block – this is the location where memory is allocated.
The Code Execution Block - this is where your code runs.
For better Visualization👇
In Example
➖ In 1st phase (Inside the Memory Block):-
➖ The variable 'num' will be initialized with an undefined value and the function 'multi' will be initialized with the entire function description and the variable 'num1' will also be initialized with an undefined value.
In 2nd Phase:-
➖ The default value which is 5 will be assigned to the variable 'num',and the multi-function with the value of 5 will be assigned to the variable 'num1'.
➖ The JavaScript Engine will create a "Memory Block" and a "Code Execution Block" for the 'multi-function.
Inside the memory block, variables 'n' and 'result' will be initialized with undefined and the code execution block will perform the function's operation and assign that value to variable 'result' .Finally, the control will return to the location where the function was called.
For More Download our free JavaScript Resources ebook Here: Click Here
Top comments (0)