Javascript setinterval function with arguments
javascript
Solution
Use an anonymous function
intId = setInterval(function(){waiting(argument)}, 10000);
This creates a parameterless anonymous function which calls `waiting()` with arguments
Or use the optional parameters of the `setInterval()` function:
intId = setInterval(waiting, 10000, argument [,...more arguments]);
Your code ( `intId = setInterval(waiting(argument), 10000);`) calls `waiting()` with `argument`, takes the return value, tries to treat it as a function, and sets the interval for that return value. Unless `waiting()` is a function which returns another function, this will fail, as you can only treat functions as functions. Numbers/strings/objects can't be typecast to a function.
Problem
How do I pass arguments in the setInterval function Eg: ``` intId = setInterval(waiting(argument), 10000); ``` It shows error `: useless setInterval call (missing quotes around argument?)`