Command Palette

Search for a command to run...

Hectal
Phase 2: Functions
TypeScript · Exercise 3 of 6 PreviousNext
Beginner

Type the Callback

mapNumbers calls a function on every number and collects the results. Type the callback fn as a function that takes a number and returns a string, and give the function a return type.

A callback that takes a string, or that returns a number, must be rejected.

What Check tests

  1. Your code has no type errors
  2. The console prints [ '#1', '#2', '#3' ]
  3. A callback taking a string is rejected
  4. A callback returning a number is rejected

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Console

Nothing printed yet.