Function Declaration
export function fnStatement(a: number, b: number): number { return a + b; }
Function Expression
const addNumbers = (a: number, b: number): number => a + b;
(): string
is a return type
value
that is returned from a function(param: int)
represents the parameters of the function, where the type is an integer
Parameters
need their own typing// void return type function messageLogger(message: string): void { console.log(message); } // primitive return type function addNumbers(a: number, b: number): number { return a + b; } // Optional Parameter `y` function newFunc(x: number, y?: number) { ... } // Default Parameter function newFunc(name: string = "you"){ ... }