0 of 6 problems solved0%
2 of 6

Alias the Callback

Function type expressions can also be aliased. Giving a name to a callback shape makes code easier to read and reuse. Keep parameter and return types explicit.

  • Name a function type for clarity (e.g., (n: number) => string).
  • Map an array without mutating the original.
  • Return a new array of formatted strings.

Your Task

  1. Define type Stringifier = (n: number) => string.
  2. Implement formatAll(nums: number[], fmt: Stringifier): string[] that maps each number using fmt.