Site icon Technote blog

Typescript Functions Clone A

TypeScript has a specific syntax for typing function parameters and return values.

Read more about functions here.

Return Type

The type of the value returned by the function can be explicitly defined.

// the `: number` here specifies that this function returns a number
function getTime(): number {
  return new Date().getTime();
}
Exit mobile version