title: Self-reference in Class literal, and instantiate with a DOM element
body: <p>I'm trying to get access to the Position X and Y of the element, created in Class literal (or any other way possible, like in object literal), and a method that uses these properties too, accessing their styles.</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>class ObjectScene {
    constructor(element) {
      this.element = element;
      let posX = this.element.offsetLeft;
      let posY = this.element.offsetTop;
  
      this.resetWall = () =&gt; {
        this.element.style.left = 'unset';
        this.element.style.right = '0px';
      }
    }
  }
  
  const wall = new ObjectScene(document.getElementById('wall'));
  console.log(wall.posX);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wall" id="wall"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is it because the posX and posY is not referencing the DOM element yet? i get undefined and NaN trying to console.log the properties.</p>
  
  <p>I'm  doing it because i have like 3 functions using all the same properties,  position, reset position and stuff like that, but each one a different DOM element. So this was one way i thought of doing for dry code. </p>