Core ModulesLesson 31Free preview
Timers Module
This lesson is part of Node.js · All levels
Summary
The timers module provides code execution scheduler such as setTimeout, setInterval, and setImmediate. Timers can be scheduled, canceled with clear, and combined with unref to keep the process alive. Understanding the timer helps you control the asynchronous flow with precision.
Key points
- SetTimeout runs the code once after a certain break
- SetInterval runs repeated code at the same interval
- ClearTimeout and clearInterval cancel the running timer
- SetImmediate executes callback at the check event loop phase
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.