ClearInterval() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
23rd Nov 2017, 11:24 AM
I'm_Groot
I'm_Groot - avatar
9 Answers
+ 2
prompt should not be inside the timer function.
23rd Nov 2017, 11:31 AM
Calviղ
Calviղ - avatar
+ 2
Nice👍 code but when i click any number or click cancel in the prompt it keeps on saying "Hello"
23rd Nov 2017, 11:51 AM
I'm_Groot
I'm_Groot - avatar
+ 2
you gotta put that 'document.write("hello"); ' in else
23rd Nov 2017, 11:54 AM
I'm_Groot
I'm_Groot - avatar
+ 1
but its much easier to use var x like that
23rd Nov 2017, 11:34 AM
I'm_Groot
I'm_Groot - avatar
+ 1
i just created it as an example for set and clearinterval,,But thanks.. your profile is great
23rd Nov 2017, 11:37 AM
I'm_Groot
I'm_Groot - avatar
+ 1
If you like to use timer to print hello, clear timer to stop print Check out this https://code.sololearn.com/W956sToFPV12/?ref=app
23rd Nov 2017, 11:47 AM
Calviղ
Calviղ - avatar
+ 1
Then you to check x value make sure it's a number and also not zero( cancel return 0) if(!isNaN(x) && x!==0) Check the same code again
23rd Nov 2017, 12:00 PM
Calviղ
Calviղ - avatar
+ 1
but i think mine is easier !! but you're a big coder i accept it👌👌
23rd Nov 2017, 12:03 PM
I'm_Groot
I'm_Groot - avatar
0
No need to use setInterval and clearInterval function. Just call startandstop() directly. https://code.sololearn.com/W42IpSo8k8iZ/?ref=app
23rd Nov 2017, 11:35 AM
Calviղ
Calviղ - avatar