Loading...
By continuing to use the platform, you accept the terms of the Privacy Policy and the use of cookies.
Write a sleep(ms) function that returns a promise that resolves after the specified number of milliseconds.
sleep(ms)
The function should pause code execution for the given time, which is commonly used in async/await for delays.
await sleep(1000); // pause for 1 second console.log('1 second passed');
Run your code to see results.
Click the Run button above