DEV Community

Cover image for Building a Countdown App

Building a Countdown App

Emmanuel Os on April 17, 2021

Building the count app with JavaScript, but before that, I will highlight the steps we will be taking. write our html code write our css for styl...
Collapse
 
prakh_r profile image
Prakhar Yadav

Great tutorial. Good for practice.
Can you please help me with the meaning of 0${time}
and the whole line as well.

return time < 10? `0${time}` : time;

Collapse
 
eworld profile image
Emmanuel Os
0${time}
Enter fullscreen mode Exit fullscreen mode

Means adding zero (0) to the time if is less than 10, when counting down.

return time < 10? `0${time}` : time;
Enter fullscreen mode Exit fullscreen mode

We use return ternary to check the time and add 0 to it, if the count down is less than 10 or return the normal format time, when counting down.

Thank you
I hope this helps

Collapse
 
prakh_r profile image
Prakhar Yadav

thanks a ton :)
And please keep stuff like this coming.
Projects like these are fun and helpful for beginners and others to keep in touch with the language.
Cheers ๐Ÿฅ‚

Thread Thread
 
eworld profile image
Emmanuel Os

Sure I will.
Thank you

Collapse
 
therickedge profile image
Rithik Samanthula

Awesome to see that you are progressing man. Looking forward to some more great content!

Collapse
 
eworld profile image
Emmanuel Os

Thanks, sure I will

Collapse
 
andrewbaisden profile image
Andrew Baisden

Cool tutorial.

Collapse
 
mitya profile image
Dima

What about clearInterval?

Collapse
 
michi profile image
Michael Z

Note that setInterval of 1000ms will actually not trigger the callback exactly every 1000ms. More info here: m.youtube.com/watch?v=MCi6AZMkxcU

Collapse
 
eworld profile image
Emmanuel Os

Thanks so much

Collapse
 
mafee6 profile image
Mafee7

EZ

Collapse
 
eworld profile image
Emmanuel Os

Noted, I will in the next one

Collapse
 
andrewbaisden profile image
Andrew Baisden

So many people do not realise this. Maybe the Write a new post page should have some sort of instructions or some markdown snippets. Or even better a way to automatically add those tags.

Collapse
 
eworld profile image
Emmanuel Os

Sure. I think so