← Practice
Functions·medium 18 min 75 XP

Custom Map

Reimplement Array.prototype.map as myMap(array, callback) without using the built-in .map.

Examples

  • myMap([1,2,3], x => x * 2) → [2,4,6]

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
Custom Map · editor

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