TypeScript Functions
Give each parameter a type, and optionally a return type after the parentheses. TypeScript then checks you call the function correctly.
function add(a: number, b: number): number {
return a + b
}
console.log(add(2, 3))
Try it yourself
Loading editor…