TypeScript code is executed synchronously by default, where each line of code is executed after each other. However, TypeScript code can also be asynchronous, which means things can happen independently of our code. Calling a REST API is an example of asynchronous code because the API request is handled outside of our TypeScript code. So, interacting with a REST API forces us to write asynchronous code.
In this section, we'll take the time to understand the approaches we can take when writing asynchronous code before using them to interact with RESTful APIs. We'll start in the next section by looking at callbacks.