0
What do you do if you want to use setinterval with a function that takes parameters (since you don't include parentheses)?
1 Respuesta
+ 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);