title: Uncaught TypeError: Cannot read property 'style' of undefined in object
body: <p>I don't know what I am missing here, can you please help me.</p>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;    
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;SNOW&lt;/title&gt;
      &lt;meta charset="UTF-8"&gt;
  &lt;/head&gt;
  &lt;body&gt;  
  &lt;div id="snowDiv"&gt;*&lt;/div&gt;
  &lt;/body&gt;
  &lt;script&gt;
      var SNOW = function () {
          this.top = 0;
          this.left = 0;
          this.snowflake = document.getElementById('snowDiv');
          this.snowflake.style.margin         = this.top+'px 0px 0px '+this.left+'px';
          this.snowflake.style.positon        = 'absolute';
          this.snowflake.style.zIndex         = '1';
          this.snowflake.style.position       = 'absolute';
          this.snowflake.style.height         = '5px';
          this.snowflake.style.width          = '5px';
          this.moveSnow = function () {
              SNOW.top += 2;
              SNOW.left += 5;
              SNOW.snowflake.style.margin = SNOW.top+'px 0px 0px '+SNOW.left+'px';
              window.requestAnimationFrame(SNOW.moveSnow);
          };
      };
      var snowing = new SNOW();
      snowing.moveSnow();
  &lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <p>If I put the moveSnow function outside the SNOW object it works, but like that it does not.</p>