【发布时间】:2015-01-19 03:57:07
【问题描述】:
为什么会抛出“Uncaught TypeError: Illegal invocation”?
function Game () {
this.reqAnimFrame = window.requestAnimationFrame;
this.gameLoop = function () {
this.reqAnimFrame(this.gameLoop); // It's thrown on this line
};
}
var game = new Game();
game.gameLoop();
【问题讨论】:
-
这是一种方法,所以在 this.gameLoop 之后需要
()
标签: javascript web typeerror