The delay in milliseconds.
A promise that resolves after the specified delay.
// Basic usage
await sleep(1000); // Pauses execution for 1 second
// Using in an async function
async function example() {
console.log('Start');
await sleep(2000);
console.log('2 seconds later');
}
// Using with .then()
sleep(3000).then(() => console.log('3 seconds have passed'));
Creates a promise that resolves after a specified delay.