- What is the difference between synchronous and asynchronous functions?
synchronous is single threaded and can only do one job (function) at a time
an asynchronous task can be initiated and then put aside until a later date while our
programm gets started on the next task on the to-do list.
- What is callback hell?
more complex operations tend to produce even more levels and sub-levels of nested functions, which is known as callback hell. It makes the code hard to maintain as it gets complex real fast
- Which technique can help us solve callback hell?
What is a promise?
The core idea behind promises is that a promise represents the result of an asynchronous operation. A promise is in one of three different states:
- pending - The initial state of a promise.
- fulfilled - The state of a promise representing a successful operation.
- rejected - The state of a promise representing a failed operation.
Once a promise is fulfilled or rejected, it is immutable (i.e. it can never change again).