What do you do if you want to use setinterval with a function that takes parameters (since you don't include parentheses)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What do you do if you want to use setinterval with a function that takes parameters (since you don't include parentheses)?

21st Mar 2016, 7:30 PM
Jeremiah
Jeremiah - avatar
1 Answer
+ 4
Using what you've learned in this tutorial so far: function myIntervalFunction(){ myFunction(a,b,c); }; setInterval(myIntervalFunction, 2000); The simple way: setInterval(function(){ myFunction(a, b, c); }, 2000); A more direct way (not recommended if you aren't sure what it does): setInterval(myFunction.bind(null, a, b, c), 2000);
10th Oct 2016, 4:31 PM
Schindlabua
Schindlabua - avatar