
setTimeout(fn, ms) runs a function once after a delay in milliseconds. setInterval(fn, ms) runs a function repeatedly at a fixed interval. Both are asynchronous — they don't block the rest of your code. Use clearTimeout() and clearInterval() to cancel them. These are essential for animations, polling, and delayed UI updates.
Reference:
TaskLoco™ — The Sticky Note GOAT