DEV Community

Discussion on: Create a digital clock using Javascript

Collapse
 
diosamuel profile image
diosamuel

i think we can use requestAnimationFrame instead of setInterval

Collapse
 
javascriptacademy profile image
Adam Nagy

That is mostly used for animations but can work here too. Nice suggestion. 😊

Collapse
 
mnathani profile image
Murtaza Nathani

I would second vsam.. interval api would not be accurate

Collapse
 
devkam profile image
Muhammad Kamel Umar

set time interval works perfectly. But with request animation frame you need to refresh the browser before the time updates.

Collapse
 
devkam profile image
Muhammad Kamel Umar

Set time interval works perfectly. But with request animation frame you need to refresh the browser before the time updates.