DEV Community

Discussion on: Building a Countdown App

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