Instantiating a class and then pass it to setInterval
问题 I've a crazy problem. I'm instantiating an object from a class. Then I want to pass a function from this object to the setInterval function. The whole code block is executed with a keyDown event. Here's the code: function doKeyDown(e){ var instance = new Class(e.keyCode); setInterval(instance.functionToBeExecuded(), 200); } The strange thing is that it's getting executed once and then starts to loop an error which states (firebug): 27 SyntaxError: missing ] after element list [object