DEV Community


How to implement a simple countdown timer in JavaScript

steinbring profile image Joe Steinbring ・1 min read

This is going to be a pretty quick little post. I was asked yesterday about how I would implement a countdown timer in just plain vanilla javascript. Here is my solution ...

You'll see that I am using setInterval() to recreate the countdown object once every 1 second. Once it is recreated, I am using document.getElementById().innerHTML to refresh the page.

Have any questions, comments, etc? Feel free to post a comment, below.

Discussion (0)

Editor guide