--- title: "setTimeout(): Node.js vs Web" date: "2025-05-16" tags: - Art --- - In Node.js, [setTimeout()](https://nodejs.org/dist/latest-v18.x/docs/api/timers.html#settimeoutcallback-delay-args) returns a [\](https://nodejs.org/dist/latest-v18.x/docs/api/timers.html#class-timeout) object. - In web, [setTimeout()](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) returns a number (`timeoutID`). Both return values are passed to `clearTimeout()` to cancel the timeout.