← Practice
Functions·easy 10 min 50 XP

Callback Exercise

Write applyOperation(a, b, callback) that calls callback with a and b and returns the result.

Examples

  • applyOperation(3, 4, (x, y) => x + y) → 7

Constraints

  • Keep the required function name so the tests can find it
  • Return a value instead of only logging it
  • Do not mutate inputs unless the challenge asks you to
Callback Exercise · editor

Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.