A promise-based delay returns control while a timer waits. It establishes a minimum delay, not an exact execution timestamp.
Worked example
import {
setTimeout as delay,
setImmediate as immediate,
} from "node:timers/promises";
console.log(await delay(1, "done"));Result
doneImplementation notes
Timer work competes with other callbacks. For recurring sampling, compare actual timestamps rather than assuming every tick arrived exactly on schedule.
Try it yourself
Schedule the same delay while another operation occupies the event loop.
Open the Node.js example →Editorial date April 7, 2026 · Published December 6, 2026