JavaScript engine executes javascript code in a single thread.
It’s like Bar with a single bathroom.
Event loop line to use the bathroom. The queue holds the work that should happen.
The callback (also known as a call-after) function is the executable code that is passed as an argument to other function which is expected to call back the argument at a given time or later at a convenient time.
- Synchronous callback
- Asynchronous callback.