Async Map
Async Map
Implement an async version of Array.map that processes items with an async function.
Requirements:
- Implement
asyncMapthat takes an array and async function - Process all items and return results in original order
- All async operations should run in parallel
- Return a Promise that resolves with the array of results
Example:
const numbers = [1, 2, 3, 4];
const double = async (n) => n * 2;
asyncMap(numbers, double).then(result => {
console.log(result); // [2, 4, 6, 8]
});
Examples:
Input 1:
{"array":[1,2,3]}Output 1:
[2,4,6]Input 2:
{"array":[1,2,3,4]}Output 2:
[2,3,4,5]Loading editor...
Run your code to see results
Click the Run button above