Returns a promise that resolves with the given value after specified milliseconds. Useful for async delays, rate limiting, or creating scheduled operations.
await delay(1000)(42);// => 42 (after 1 second) Copy
await delay(1000)(42);// => 42 (after 1 second)
Value type
Number of milliseconds to delay
Promise that resolves to the value after delay
Returns a promise that resolves with the given value after specified milliseconds. Useful for async delays, rate limiting, or creating scheduled operations.
Example