+ 7
Inconsistent function behavior?
Can someone explain this for me? if I call a function within setInterval, it doesn't work. eg. 1.setInterval(player(), 3000); //this won't work. 2.setInterval(player, 3000); //this would rather work however for other functions like console.log, alert etc, if I call it without the '()' it returns the function definition
2 ответов
+ 1
SetInerval is used for function only and it accept function name value as first parameter if it is defined anywhere it will run.
But in case alert,console ....
it can be used for string ,numbers,fxn ....
hence it require () to recognise that parameter is a fxn.
+ 3
thanks 👍