Functions are central in TypeScript. We’ll learn about functions with a few different examples.
To run the program, save it as functions.ts and use ts-node (assuming you have it installed):
There are several other features to TypeScript functions. One is optional and default parameters, which we’ve seen in the plusPlus function. Another is rest parameters, which allow a function to accept any number of arguments as an array.