+ 1
How to use clearInterval and setInterval in 2 buttons
I want to make a timer with a start and stop button but putting setInterval in a different onclick function puts it out of the scope of the clearInterval onclick function. Help? https://code.sololearn.com/WOFp8gzRooBE/?ref=app
4 odpowiedzi
+ 3
You were declaring variable go in only start function so it was out of scope for other functions.
Also set setInterval for 10ms (100 in it) , its good for visualization.
Hope this helps ☺️☺️.
+ 3
If this helps
https://code.sololearn.com/WIlyIcwF0810/?ref=app
+ 1
Yes it did, thanks Meet Mehta
+ 1
:)