Reminders when Studying!
"Remember to constantly keep hydrated while studying!" - Mowgli
This page is an illustration of how setTimeout and setInterval works, using a demo
of reminders for studying and hydrating.
Timers: setTimeout (once) vs. setInterval (repeated)
- setTimeout(fn, ms) - This is used to set a timer with a specific
time delay of ms milliseconds until it calls a function fn just ONCE at a
specific delay. Once it's set off once, it won't set off again. It returns a
timerId you can use to clearTimeout later.
- setInterval(fn, ms) - This is used to set a timer for a
function fn that will go off at
regular time intervals (once every ms milliseconds). It also returns a timerId
you can use to clearInterval later.
- clearTimeout(timerId) - This is used to clear timer set by
setTimeout, but requires the timerId returned by setTimeout.
- clearInterval(timerId) - This is used to clear timers that have been set by
setInterval, but requires the timerId retdurned by setInterval.
What's the status on my timers?
y
Click on a button to set reminders and see the status of your
reminders!