What is clearInterval and how to use it?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

What is clearInterval and how to use it??

14th Jan 2017, 7:47 AM
amiel
5 Respostas
+ 8
setTimeout(callback,delay,funcparam1,funcparam2,ā€¦); function callback(funcparam1,funcparam2,ā€¦){} (you can even pass parameters)
14th Jan 2017, 9:14 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 7
Also learn about "setTimeout"ā€¦ā€¦
14th Jan 2017, 8:43 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
var x = setInterval(function() {alert("Hello")}, 1000) ; clearInterval(x)
14th Jan 2017, 7:52 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
- clearInterval(timer) cancel a timer=setInterval(func,delay) running; - timer=setTimeout(func,delay) is cancelable by clearTimeout(timer) The two kinds are for delaying the execution of the function passed in arguments, one occurs every 'delay', the other occurs only once ^^
14th Jan 2017, 9:10 AM
visph
visph - avatar
+ 1
thanks to all.
14th Jan 2017, 10:19 AM
amiel