Below I am creating an object in Javascript. Within the constructor I am setting up an event listener. The problem is that when the event gets fired, this.prop cannot be fou
You could use a variable named 'me', to avoid conflict with the global JavaScript variable 'self':
function someObj() { var me = this; this.prop = 33; this.mouseMoving = function() { alert(me.prop); } document.getElementById("someDiv").addEventListener('mousemove', this.mouseMoving, true); }