Codington
0 of 6 problems solved0%

Functions Basics

6 exercises

Functions are how we structure behavior. In TypeScript, you can describe parameter types and return types so that invalid calls are caught early:

function greet(name: string): string { return `Hello, ${name}!`; }

You can also let the compiler infer types from values and contexts, making callbacks and arrow functions pleasant to write.

In this category, you'll:

  • Annotate parameters and return types explicitly
  • Use optional (name?: string) and default (width = 100) parameters
  • Write arrow functions with type inference
  • See how TypeScript catches type errors before runtime

By the end, you'll be comfortable reading and writing function signatures, choosing when to be explicit, and relying on inference where it helps clarity.

CodingtonCodington

© 2025 Codington. Built with TypeScript, TanStack Start and a lot of console.log().