title: Referencing a javascript object from within its declaration
body: <p>Why is it possible to reference an object from within the object directly? For example:</p>
  <pre><code>var object = {
      prop1 : &quot;Prop 1&quot;,
      prop2 : &quot;Prop 2&quot;,
      func : _ =&gt; console.log(object)
  }
  
  object.func();
  </code></pre>
  <p>//output <code>{prop1: 'Prop 1', prop2: 'Prop 2', func: ƒ}</code></p>
  <p>Similarly I could do:</p>
  <pre><code>var object = {
      prop1 : &quot;Prop 1&quot;,
      prop2 : &quot;Prop 2&quot;,
      func : function() { console.log(this) }
  }
  
  object.func();
  </code></pre>
  <p>This will result in the same output as above. I am mainly trying to understand why it is legal to reference the variable name <code>object</code> from inside its declaration.</p>