Accessing values of object using "this"
<p>I have this code with me,</p>

<pre><code>var x = {
  a: 10,
  b: 20,
  c: (this.a + this.b)
};
</code></pre>

<p>where <code>this.a</code> and <code>this.b</code> is coming as undefined. So as a result of adding the both and printing it displays <code>NaN</code>. Also I tried with <code>(x.a + x.b)</code>. The results were the same.</p>

<p>Can anyone tell how do I access a JSON object's value internally using <code>this</code>? May be other way?</p>