3. Functions
Overview
Functions are a basic building block of any application. This chapter teaches you how to unleash the power of TypeScript using versatile functions that have capabilities you may not find in other programming languages. We will talk about the this
key and look at function expressions, member functions, and arrow functions. This chapter also discusses function arguments, including rest and default parameters. We will also look at the import
and export
keywords.
This chapter also teaches you how to write tests that pass different combinations of arguments and compare the expected output with the actual output. We will close the chapter by designing a prototype application and completing it with unit tests.