+ 2

Pause setInterval

Please How to pause setInterval please help me with the code https://code.sololearn.com/W3g8KxEp7tV3/?ref=app

24th Oct 2020, 6:19 PM
Ibrahim Yusuf
Ibrahim Yusuf - avatar
3 Réponses
+ 2
Ibrahim Yusuf You'll have to store the interval timestamp in a variable and use it to clear the interval. Then when play() is clicked you should create a new interval. var interval = setInterval (time,200); clearInterval(interval);
24th Oct 2020, 6:56 PM
Kevin ★
+ 4
Kevin ★ thanks, let me work on that
24th Oct 2020, 7:03 PM
Ibrahim Yusuf
Ibrahim Yusuf - avatar
+ 4
Kevin ★ Thank you, I've gotten it. check out the code https://code.sololearn.com/W3g8KxEp7tV3/?ref=app
24th Oct 2020, 7:24 PM
Ibrahim Yusuf
Ibrahim Yusuf - avatar