Incomprehensible error message. Please help me understand why the following code
function Clock(options) { var elem = options.elem; var self = this; var flag, nowTime; //this.start(); self.nowTime = function() { this.nowTime = date(); }; elem.on('click', '#clock-start', this.start); this.start = function(){ console.log(44); } } var clock = new Clock({ elem: $('#clock') });
produces an error in the console
TypeError: this.start is not a function
in addition, if I place the body of the problem function directly in the handler as an unnamed function, then the code works without errors