1. What is asynchronous code?
Asynchronous code is code that can be executed to plan future executions often while waiting for a response from other code or after a specific time has passed.
2. Describe what a callback function is
A callback function is a function passed to the asynchronous function such that the callback can be executed after the asynchronous code is finished.
3. Why do we need asynchronous code at all? Can’t we just replace it with synchronous…
When only using synchronous functions the user may have to wait with unresponsive user interfaces while the single thread code is synchronously waiting. This will provide a bad user experience.
4. What are Promises?
A promise is a function which returns an object representing a value that is intended to exist in the future.
5. What does the then() function do?
.then() waits for the response from the previous function and then executes the following code.