Introduction
So far, we've learned some of the basics of TypeScript, how to set up a project, and the use of definition files. Now we will delve into the topic of functions, which are going to be the most important tools in your arsenal. Even object-oriented programming paradigms depend heavily on functions as a basic building block of business logic.
Functions, sometimes called routines or methods, are part of every high-level programming language. The ability to reuse segments of code is critical, but functions provide an even more important role than that in that they can be given different arguments, or variables, to act against and produce different results. Writing good functions is the difference between a good program and a great one. You first need to start by learning the syntax before thinking about crafting a good function by considering what arguments it should take and what it should produce.
In this chapter, we will cover three different ways to create functions...