JavaScript Fundamentals
Definitions
The Stack
The stack is an ordered data structure. That keeps track of the functions that have been invoked. The stack is modified when a function is invoked.
When a function is invoked the details are saved to the top of the stack. (pushed to the top)
When a function is returned the information is taken off the top of the stack. (popped of the top)
The STACK is processed top to bottom
Heap
The area in memory where data is stored.
The Queue
The queue is an ordered list of functions waiting to be placed on the stack. First in first out (FIFO)
The Event loop
Functionality in the JavaScript runtime that checks the queue when the stack is empty. If the stack is empty, the front of the queue is placed in the stack.
JavaScript is Single Threaded
Single Threaded: Code execution is linear. Code that is running cannot be interrupted by something else going on in the program.