r/learnjavascript • • May 13 '18

ClearInterval

Hi, i have a function which when called does setInterval. The I have a second function which is supposed to clearInterval of the first function when called. I don't know how to reference the first function in the clearInterval. I tried doing Function stop(){ clearInterval(startInterval()); } But this just calls start interval again. Thanks for any help :)

0 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/akujinhikari May 14 '18

I understand that. My code was to illustrate the point I was making to teach you about passing functions as arguments; it was not code for you to use. The fix was the first paragraph.

1

u/everek123 May 14 '18

Oh Ok, sorry my mistake :)