this
error: Uncaught TypeError: undefined is not a function
When you invoke setTimeout()
, you are actually invoking window.setTimeout()
. Therefore, this.clearBoard();
refers to the window object.
Traditional solution
use
var self = this;
New solution
use the
bind()
method to pass in the proper reference:
Last updated
Was this helpful?