In TypeScript, a function consists of several building blocks that define its anatomy. Here’s a breakdown of the
different parts:
- Function Name: This is the identifier used to call the function.
- Function Signature: Defines the shape of the function, including parameter list,
this
context and return type - Function Body: This is the block of code enclosed within curly braces (
{}
). It contains the instructions and
statements that define the behavior of the function. The code within the function body is executed when the function
is called.