I have this code with me,
var x = {
a: 10,
b: 20,
c: (this.a + this.b)
};
where this.a
and this.b
is coming as undefined. So as a result of adding the both and printing it displays NaN
. Also I tried with (x.a + x.b)
. The results were the same.
Can anyone tell how do I access a JSON object's value internally using this
? May be other way?