Proper Syntax of ClearInterval?

I have a Javascript code, what is the appropriate syntax for calling a ClearInterval function on a setinterval?

28th Jul 2018, 8:08 PM
Joshua Morgan
Joshua Morgan - avatar
3 Answers
+ 1
var interval = setInterval(DoStuff, 20); clearInterval(interval);
28th Jul 2018, 8:22 PM
+ 3
if you assign the setInterval() function to a variable, you can use that variable to clear it like in Jason Edelson 's example
28th Jul 2018, 9:07 PM
ReimarPB - avatar