Cannot read property on Object (undefined?) inside instance
<p>When i try to access the object <strong>this.guy</strong> from the event function <strong>onMouveMove</strong> i get the following error:</p>

<pre><code>"Uncaught TypeError: Cannot read property 'prop1' of undefined"
</code></pre>

<p>When i inspect with Chrome's Devtool, the value exist and is there, it just doesn't recognize inside the "onMouseMove" function.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>MyClass = function(some_html_element){
  this.guy = {"prop1":[]};
  some_html_element.onmousemove = this.onMouseMove;
}
    
MyClass.prototype.onMouseMove = function(evt){
  if(!this.guy.prop1){    //&lt;- here's the error
            alert("no error");
  }
}

a = new MyClass(document.querySelector("#example"))</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="example"&gt;
MOVE MOUSE ON ME
&lt;/div&gt;</code></pre>
</div>
</div>
</p>

<p>Any ideas ?</p>