We will develop a simple web application that uses the Free Dictionary API to look up word definitions. This chapter serves as an introduction to using APIs in web applications. To that end, we will employ the JavaScript Fetch function to make requests to the API and handle the responses. Moreover, we will learn about asynchronous programming in JavaScript and how to work with Promises.
We will build this application once in JavaScript to demonstrate the concepts and techniques discussed. Then we will refactor the code to use TypeScript, a statically typed superset of JavaScript that compiles to plain JavaScript. This will help us understand the benefits of TypeScript and how it can improve our code.