Creating Javascript object based on one of its own variable?
<p>Here is some javascript code that I have:</p>

<pre><code>   var screenWidth = 1280;
   var screenHeight = 720;

   var shapeComtainer = {
    name : "bender",
    offsetX : 100,
    offsetY : 100,
    width : screenWidth - 2*offsetX,
    height : screenHeight - 2*offsetY,
   };
</code></pre>

<p>I am getting the error offsetX and offsetY are not defined. This is in the lines where I am calculating width and height. The issue is that my width and height is dependent upon other variables inside the same object.</p>

<p>Is there a better/correct way to have a javascript object that represents information such as offsets and size information?</p>
