I want to restart countdown. | Sololearn: Learn to code for FREE!


I want to restart countdown.

I wish when user click on Resend Button then the again setInterval() restart. https://code.sololearn.com/Wh2iQk06AOl0/?ref=app

6/22/2018 12:50:11 PM

Satish Kumar Sharma

2 Answers

New Answer


Here I fixed the code. I have comments made so you can see exactly what I changed. First off, you need to make the button visible again once you hide it. You also need to reset the variable "t" in order for your timer to reset. https://code.sololearn.com/W2uC293nx4nt/?ref=app


I had a quick glance, you will need to set your timer ( t variable ) back to 5 after functions is executed so it can go again from 5. Otherwise it stays at 0 so it will never start again as condition is not met.