Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a function to convert a callback-based function to a Promise-based one.

Hard

Problem Statement

Write a function to convert a callback-based function to a Promise-based one.

Sample Input

A callback function setTimeout that resolves after 2 seconds.

Sample Output

Callback resolved

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
function promisify(fn: Function): (...args: any[]) => Promise<any> { // Your logic here }
Log in or sign up to run or submit your code.Log inSign up
Input
A callback function setTimeout that resolves after 2 seconds.
Expected Output
Callback resolved